在jsp使用Struts2标签的时候会发现,出现严重变形问题。
<s:textfield type="text" name="username" label="作者名"
class="text-input" />
解决方法,在struts.xml文件当中加入,如果要使用class请使用cssClass代替class
<!-- 让jsp拥有html同样的样式,防止变形 -->
<constant name="struts.ui.theme" value="simple" />
<constant name="struts.ui.templateDir" value="template" />
<constant name="struts.ui.templateSuffix" value="ftl" />
加入后发现,部分问题解决了,但是设置的
class="text-input"样式无效,不像其它输入框一样的样式,
因为class被Struts2占用了,如果要使用class请使用cssClass代替class
<s:textfield type="text" name="username" label="作者名"
class="text-input" />
解决方法,在struts.xml文件当中加入,如果要使用class请使用cssClass代替class
<!-- 让jsp拥有html同样的样式,防止变形 -->
<constant name="struts.ui.theme" value="simple" />
<constant name="struts.ui.templateDir" value="template" />
<constant name="struts.ui.templateSuffix" value="ftl" />
加入后发现,部分问题解决了,但是设置的
class="text-input"样式无效,不像其它输入框一样的样式,
因为class被Struts2占用了,如果要使用class请使用cssClass代替class
本文介绍了在使用Struts2标签时遇到的样式问题及解决方案。通过修改struts.xml配置文件,采用特定语法来实现一致的样式效果。
938

被折叠的 条评论
为什么被折叠?



