zoukankan      html  css  js  c++  java
  • Struts表单格局;theme三个属性值:simple,xhtml,css_xhtml

    转自:http://www.educity.cn/wenda/7156.html

      解决Struts2 Form表单自己布局之前先看看 theme 属性, theme属性提供 三个属性值:simple,xhtml,css_xhtml,分别对应3个模板主题。

      simple就是什么模板都不要,xhtml是默认的,如果你的页面用了css布局,又想用struts2的增强功能就用css_xhtml

      先看看一个Struts2 表单应用

      <s:form action="saveuser.action" theme="simple"> <s:textfield name="u_id" label="用户名" cssClass="border"></s:textfield> </s:form>

      (1)当theme 属性值设置为simple,生成的HTML代码为:

    1 <input type="text" name="u_id" value="" id="saveuser_u_id" class="border"/>

      这时如果使用验证框架,则验证Message不能正常显示,需要添加

    1 <s:fielderror>
    2     <s:param>u_id</s:param>
    3 </s:fielderror>

      (2)当theme 属性值设置为xhtml,生成的HTML代码为

     1 <table class="wwFormTable">
     2   <tr errorFor="saveuser_u_id">
     3     <td align="center" valign="top" colspan="2"><span class="errorMessage">请填写用户ID </span></td>
     4   </tr>
     5   <tr>
     6     <td class="tdLabel"><label for="saveuser_u_id" class="errorLabel">用户名:</label></td>
     7     <td><input type="text" name="u_id" value="" id="saveuser_u_id" class="border"/></td>
     8   </tr>
     9   <ul>
    10     <li><span class="errorMessage">请填写用户ID </span></li>
    11   </ul>
    12 </table>

      看到这相信使用Struts2标签的都知道怎么自定义布局了。

  • 相关阅读:
    收藏的日历js算法 很实用
    autofac system.core 的版本问题
    and 组件ui等
    vc相关
    live传264流
    录转rtsphan
    ndk errno
    cpp all记录
    and 录音等+live等
    cmake
  • 原文地址:https://www.cnblogs.com/x_wukong/p/3626957.html
Copyright © 2011-2022 走看看