data标签
<%
pageContext.setAttribute("birth",new Date(200,03,10),PageContext.REQUEST_SCOPE);
%>
<s:date name="#request.birth" format="yyyy年MM月dd日"/>
<s:date name="#request.birth" nice="true"/>
这个标签是按照format的格式去输出的。
表单
<s:form action="test" namespace="/tag">
<s:textfield label="用户名" name="uname" tooltip="你的名字" javascriptTooltip="false"></s:textfield>
<s:textarea name="rmake" cols="40" rows="20" tooltipDelay="300" tooltip="hi" label="备注" javascriptTooltip="true"></s:textarea>
<s:password label="密码" name="upass"></s:password>
<s:file name="file" label="上传文件"></s:file>
<s:hidden name="id" value="1"></s:hidden>
<s:select list="#{'1':'博士','2':'硕士'}" name="edu" label="学历" listKey="key" listValue="value"></s:select>
<s:select list="{'java','.net'}" value="java"></s:select><!-- value是选中的 -->
<!-- 必须有name -->
<s:checkbox label="爱好 " fieldValue="true" name="checkboxFiled1"></s:checkbox>
<!-- 多个checkbox -->
<s:checkboxlist list="{'java','css','html','struts2'}" label="喜欢的编程语言" name="box" value="{'css','struts2'}"></s:checkboxlist>
<!-- map集合前要加# -->
<s:checkboxlist list="#{1:'java',2:'css',3:'html',4:'struts2',5:'spring'}" label="喜欢的编程语言" name="boxs" value="{1,2}"></s:checkboxlist>
<!-- listKey listValue <input type="text" name="boxs" value="listKey">显示值listValue -->
<!-- radio -->
<%
//从服务器传过来值
pageContext.setAttribute("sex","男",PageContext.REQUEST_SCOPE);
pageContext.setAttribute("sex1","男",PageContext.REQUEST_SCOPE);
%>
<s:radio list="{'男','女'}" name="sex" value="#request.sex"></s:radio>
<s:radio list="#{1:'男',2:'女'}" name="sex1" listKey="key" listValue="value" value="#request.sex1"></s:radio>
<!-- 防止表单提交的方式 -->
<s:token></s:token>
<s:submit value="提交"></s:submit>
</s:form> |