Struts2 ui标签
命名空间:在form action=”命名空间名/action”
struts2 ui标签库
引包: <%@taglib uri="/struts-tags"prefix="s" %>
<%@taglib uri="/struts-tags"prefix="s" %>
<s:form action="login"method="post" name="frm"id="frm" theme="xhtml">
<s:textfield name="user.uname"label="username"></s:textfield>
<s:password name="user.pwd"label="password"></s:password>
<s:radio list="{'男生','女生','男人','女人','男子','女子'}" name="sex"label="性别"></s:radio>
<s:checkboxlist list="{'vrey','good','bad','坏','孬','好'}" name="hobby" label="爱好"></s:checkboxlist>
<s:select list="{'北京','南京','东京'}" name="city" label="城市"></s:select>
<s:textarea rows="5"clos="20" name="info"label="自己介绍"></s:textarea>
<s:submit label="登陆"></s:submit>
</s:form>
ognl:
<s:property value="#application.user.pwd"/>
struts.xml通配符使用:
struts.xml:
<action name="user_*"class="com.bjsxt.action.LoginAction" method="{1}">
<result name="{1}">/ognl.jsp</result>
</action>
.jsp:
<form action="user_zzu">
<input type="submit"value="zzu">
</form>
.java:
public String zzu() {
user.setUname("zzdx");
user.setPwd("yyuy");
return "zzu";
}