我是Stuts2框架的新手。我使用多个struts2 UI标记,但标签不可见。代码如下:
<div>
<s:textfield name="firstName" label="First Name" theme="simple" />
<s:textfield name="middleName" label="Middle Name" theme="simple"/>
<s:textfield name="lastName" label="Last Name" theme="simple"/>
<s:textfield name="empId" label="Employee Id" theme="simple"/>
</div>
我希望这些UI标记与标签一起放在一行。
答案 0 :(得分:2)
然后删除theme="simple"
;
简单主题不会生成任何额外的HTML标记,允许您完全控制输出;
XHTML主题(这是默认设置)将用标签,表格等装饰您的标签。
答案 1 :(得分:1)
Struts2标签以FreeMarker为主题。您可以通过在struts.properties中指定以下内容,从简单主题更改为默认XHTML主题:
# Standard UI theme
struts.ui.theme=xhtml
或者您可以通过添加主题属性来覆盖这些标记的主题,如下所示:
<div>
<s:textfield name="firstName" label="First Name" theme="xhtml" />
<s:textfield name="middleName" label="Middle Name" theme="xhtml"/>
<s:textfield name="lastName" label="Last Name" theme="xhtml"/>
<s:textfield name="empId" label="Employee Id" theme="xhtml"/>
</div>