Struts2 tags in divs appear empty

落花浮王杯 提交于 2019-12-02 11:08:27
Andrea Ligios

Like described in this answer (that you should consider upvoting too), Struts2 generates (or not) a certain kind of HTML when rendering Struts Tags, basing on the Theme you have chosen.

The default one is xhtml, that will generate a lot of stuff for you. It may be handy, but also annoying, according to how you work. Personally I prefer to generate the HTML by myself, and then I use the theme that won't generate almost any HTML: the simple Theme.

Note that when working on big projects or with multiple projects with the same, particular needs, you can also write your own custom theme (for example for generating security tokens automatically).

You can use a theme globally (in struts.xml)

<constant name="struts.ui.theme" value="simple" />

or locally to a single tag / form:

<s:checkbox name="chBx" id"chBx" fieldValue="false" 
           theme="simple"
           value="true" label="Check This" />

In this case, you may need to write the <label> object by yourself.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!