如何在struts2中使用简单主题

如何在struts2中使用简单主题,struts2,Struts2,我是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="lastNam

我是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>
<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>


我希望这些UI标签与其标签在一行中。

Struts2标签使用FreeMarker作为主题。通过在struts.properties中指定以下内容,可以从简单主题更改为默认的XHTML主题:

# Standard UI theme
struts.ui.theme=xhtml
或者,您也可以通过添加主题属性来覆盖这些标记的主题,如下所示:

<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>
<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>


这里有一些。

Struts2标签使用FreeMarker作为主题。通过在struts.properties中指定以下内容,可以从简单主题更改为默认的XHTML主题:

# Standard UI theme
struts.ui.theme=xhtml
或者,您也可以通过添加主题属性来覆盖这些标记的主题,如下所示:

<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>
<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>

这里有一些。

然后删除
theme=“simple”

简单主题不会生成任何额外的HTML标记,允许您完全控制输出

XHTML主题(这是默认的)将用标签、表格等装饰您的标签。

然后删除
Theme=“simple”

简单主题不会生成任何额外的HTML标记,允许您完全控制输出

XHTML主题(这是默认的)将用标签、表格等装饰您的标记