14-struts2的表单标签

struts2的表单标签

<form>-------------------<s:form>
<input type="text">------<s:textfield>
<input type="password">---<s:password>
<input type="submit">-----<s:submit>
<input type="reset">------<s:reset>

      • 1.改造form

<s:form id="loginAction_home" name="form1" action="user_login" namespace="/" target="_parent" method="post">

      • 2.改造登录名

<s:textfield name="logonName" value="" id="logonName" cssClass="text" cssStyle=" 160px;"/>

      • 3.改造登录密码

<s:password name="logonPwd" id="logonPwd" cssClass="text" cssStyle=" 160px;"/>
密码框默认不回显示.需要设置属性showPassword="true"

      • 4.<s:submit name="submit" value="登录" cssClass="buttoninput"/>
      • 5.<s:reset name="reset" value="取消" cssClass="buttoninput"/>


注意:struts2中的表单标签,有默认的主题xhtml.如果不想要添加任何修饰,只需要将主题修改为simple.


问题:怎样设置主题

 

      • 1.全局

在struts.xml文件中配置一个常量
<constant name="struts.ui.theme" value="simple"></constant>

      • 2.局部

针对于某一个form.
<s:form theme="simple">

      • 3.局部

可以给任意的表单组件去指定theme属性值。

原文地址:https://www.cnblogs.com/1963942081zzx/p/6510899.html