struts2—from标签中 theme="simple" 用法
2009-11-09 10:47
465 查看
<table align="center"> <tr> <td> <s:textfield label="%{getText('username')}" name="username" size="20" cssClass="input01" theme="simple"/> </td> </tr> <tr> <td> <s:textfield label="%{getText('userpass')}" name="userpass" size="20" cssClass="input01"/> </td> </tr> </table>
这样的话,struts2框架会自动生成label以及一些提示信息,生成的html代码如下:
<table align="center"> <tr> <td> <input type="text" name="username" size="20" value="" id="_username" class="input01"/> </td> </tr> <tr> <td> <tr> <td class="tdLabel"><label for="_userpass" class="label">密码:</label></td> <td> <input type="text" name="userpass" size="20" value="" id="_userpass" class="input01"/> </td> </tr> </td> </tr> </table>
我们会发现有生成许多代价,有些时候还会生成错误提示信息的代码,可我不想要它啊,我想把它放到别的地方去,或者干脆说,我只想用Struts的action处理机制,不想用struts的默认布局,又或者你想做。。。。。。总之就不要默认的,怎么办?
这就涉及到struts2的theme(主题)了,换不同的主题,可以让struts的代码输出不同的html代码,你也就相应得到不同的布局效果,我就是这么理解theme的,并且换theme也非常简单,这样你可以设定N个不同的主题,每五分钟换一个都行啊(你喜欢的话)
问题一:Struts2有哪些主题?
Struts2提供了三种主题,ajax, simple, xhtml,它默认的是xhtml主题,当然你可以写任意个你自己的主题,我们称之为自定义主题
问题二:Struts2怎么改?
比如现在你想用simple主题,在Struts.xml中,加上下一行代码就可以了
<constant name="struts.ui.theme" value="simple" />
或者:在你的struts.propertise内加入以下:
struts.ui.theme=simple
相关文章推荐
- struts2—from标签中 theme="simple" 用法
- struts2—from标签中 theme="simple" 用法 .
- <s:form theme="simple">导致标签名显示不出来
- 在struts-2.2.3.1中加入<s:head theme="ajax"/>这个标签,报错
- 在使用struts标签的时候最好加上theme="simple"
- radio取值,<s:radio name="view[%{#status.index}]" list='#{"同意":"同意","不同意":"不同意"}' theme="simple" />
- <s:form action="xx" namespace="xx" theme="simple"
- struts 2.0 <s:form action = "" theme="simple"> theme ="simple"
- A potentially dangerous Request.Form value was detected from the client (txtTest="").
- UVA1400 - "Ray, Pass me the dishes!"
- github安装问题解决"Unable to retrieve your user info from the server"
- theme="ajax" : Template /template/ajax/head.ftl not found异常解决
- UVALive 3938 "Ray, Pass me the dishes!"
- The content of element type "struts-config" must match "(data-sources?,form-
- "Unable to get image data from canvas because the canvas has been tainted by cross-origin data"问题产生原
- 隐藏ps -ef命令中看到的密码(Hide the password that from the " ps -ef " command)
- .NET Web 执行错误Could not load type '...' from assembly '..., Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because the me
- LA3938 "Ray, Pass me the dishes!" (线段树区间合并)
- Spring中出现The prefix "xxxx" for element "xxxxxx"is not bound.即一些标签不提示而且你又找不到dtd约束文件
- struts-config.xml配置文件顺序异常: The content of element type "struts-config" must match