当前位置:编程学习 > JAVA >>

Struts2中关于theme=simple和xml文件冲突

我想要XML文件进行验证。。在表单中,我使用s标签,<s:form action="LoginAction" method="post" theme="simple">因为想用CSS控制标签的位置。但发现表单没有显示出验证的效果,而将theme="simple" 去掉后,则出现了验证效果,请问有什么方法可以既在theme="simple"下也可以出现验证效果?

 <div class="whole">
   <s:form action="LoginAction" method="post" theme="simple" validate="true">
   <span class="s_username">用户名:<s:textfield name="username" id="username" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')"></s:textfield><br/></span>
   <span class="s_password">密    码:<s:password name="password" id="password" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')"></s:password><br/></span>
   <span class="s_marjor">专    业:<s:select id="marjor"  name="major" list="#{'计算机科学与技术':'计算机科学与技术','软件工程':'软件工程','网络工程':'网络工程'}" headerKey="未选择专业" headerValue="-请选择专业-"></s:select><br/></span>
   兴    趣:<s:checkboxlist id="hobby" name="hobby" list="#{'运动':'运动','文学':'文学','网络':'网络','其他':'其他'}" ></s:checkboxlist>
   <span class="s_gender">性    别:<s:radio list="#{'男':'男','女':'女'}" name="gender"></s:radio><br/></span>
   喜欢食物类型:<s:select name="type" id="type" list="#{'水果类':'水果类','肉类':'肉类','面类':'面类','其他':'其他' }" multiple="true" size="2"></s:select> <br/>
   感想:
   <%
   String value="输入你的感想";
   CKEditorConfig cfg=new CKEditorConfig();
   cfg.addConfigValue("width","680");
   cfg.addConfigValue("height","100");
    %>
    <ckeditor:editor editor="content" basePath="./ckeditor/" config="<%=cfg %>" value="<%=value %>"></ckeditor:editor>
    <s:submit id="submit" value="提交"></s:submit>      
    <input type="reset" value="重置" id="reset" />
   </s:form>
   </div>

<validators>
<field name="username">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>用户名不能为空</message>
</field-validator>
<field-validator type="stringlength">
<param name="trim">true</param>
<param name="minLength">4</param>
<param name="maxLength">20</param>
<message>用户名长度错误</message>
</field-validator>
</field>
<field name="password">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>密码不能为空</message>
</field-validator>
<field-validator type="stringlength">
<param name="trim">true</param>
<param name="minLength">4</param>
<param name="maxLength">20</param>
<message>密码长度错误</message>
</field-validator>
</field>
</validators>


Struts --------------------编程问答-------------------- 把theme里面的css拷贝出来写到class离去 --------------------编程问答-------------------- ···对不起啊,我没太懂您的意思。
您能写个小例子么? --------------------编程问答-------------------- 在struts.xml中加
<constant name="struts.ui.theme" value="simple" />
补充:Java ,  Java相关
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,