struts2标签的样式问题
来源:互联网 发布:javbus.me最新域名 编辑:程序博客网 时间:2024/05/22 02:04
页面标签代码:
<s:form action="dictionarytype-list" id="action_form">
<table cellspacing="0" cellpadding="0" >
<tr>
<td>数据字典类型编码:</td>
<td><input type="text" name="dictionaryType.dicTypeCode" value=" <s:property value="dictionaryType.dicTypeCode"/>" id="qry_dicTypeCode" maxlength="30" />
</td>
<td>是否启用: </td>
<td><s:if test="dicIsEnable!=null"> <s:select name="isEnable" list="dicIsEnable" headerKey="" headerValue="请选择" listKey="dictionaryKey" listValue="dictionaryValue" value="dictionaryType.isEnable" cssClass="selectClass"/></s:if></td>
<td><input type="button" value="查询" class="btnlist4" onclick="checkseracha();"/></td>
</tr>
</table>
</s:form>
样式如下:
当查看源代码时为:
<tr>
发现得:在<td>是否启用:</td>后面多了<td></td>;
<td><selectid="action_form_isEnable"class="selectClass"name="isEnable"></td>前面多了
<tdclass="tdLabel"></td>
分析得这是struts2标签自动添加上去的,这样显示的样式就乱了。
原理:在struts2中加入了theme(主题)的概念,通过设置不同的主题,可以让struts的代码输出不同的html代码,你也就相应得到不同的布局效果。
Struts2提供了三种主题,ajax, simple, xhtml,它默认的是xhtml主题,当然你可以写任意个你自己的主题,我们称之为自定义主题
解决办法如下:
1.简单的方法(也很实用)
在Struts.xml中,加上下一行代码就可以了
<constant name="struts.ui.theme" value="simple" />
代表所有的页面采用的都是 simple主题了,这时它输出的页面,不回添加任何多余的代码,比如 table tr td 等,我们就可以像其他编辑页面的方式编辑页面的风格。
或者 在 <s:form 中添加 theme
<s:form theme="simple"></s:form>
struts2每个标签都有theme属性
2.在Struts.properties里改:
#设置主题
struts.ui.theme=simple
- struts2标签的样式问题
- struts2标签样式问题。
- struts2 去除 标签样式
- Struts2 标签加样式
- Struts2 datetimepicker 标签的问题
- Struts2 datetimepicker 标签的问题
- struts2标签赋值的问题
- struts2 标签中传值的问题
- Struts2 标签和标签顺序的问题
- struts2标签与默认样式
- 去除 struts2 标签中的自动生成的布局样式
- 去除 struts2 标签中的自动生成的布局样式
- 去除 struts2 标签中的自动生成的布局样式
- 去除struts2 标签中的自动生成的布局样式
- 关于struts2 select标签默认样式的修改
- Struts2的标签,valueStack,$ ,# ,% 的问题
- struts2标签需要注意的问题
- STRUTS2中iterator标签的问题
- 《div》的边框
- 试验宋宝华驱动第十章中的second秒字符设备
- table格式的设置的简便设置
- J2EE技术规范(六)——JTA(核心概念,ACID属性)
- HDOJ--1003Max Sum
- struts2标签的样式问题
- 数据库查询的代码
- ASP.NET如何进行性能优化问题
- 市场营销学1——入门
- Eclipse Android编程快捷键
- LeetCode : Add Binary
- Eclipse使用入门
- 如何在已有的VC++工程中使用BCG界面库?
- printf()