struts2,如何在不更改主题的情况下更新HTML Struts标签的标准双列表布局(struts2, How to update Standard two-column table layout for the HTML Struts Tags without changing theme)

我正在为我的应用程序使用struts2。 在struts2中,默认情况下在两列表中放置表单,左列中的每个输入字段都有标签,右列中的输入字段(Label #input field#)。 但就我而言,我需要连续四列(Label #input field#Label #input field#)。 有没有办法做到这一点,而不改变我的主题(xhtml)?

我不希望对主题进行任何更改,是否有任何方法可以欺骗每个struts标记的#tr#,#td#标签。

I'm using struts2 for my application. In struts2,by default lays forms out in a two column table with the label for each input field in the left column and the input field in the right column (Label #input field#). But in my case, I need four-column in a row (Label #input field# Label #input field#). is there any way to do this, without changing my theme(xhtml) ?

I don't want any changes to theme, is there any way to cheat auto rendering #tr#,#td# tags for each struts tag.

最满意答案

如果你需要连续四列,那么你需要完全控制<s>标签或只是跳过<s>标签并拥有自己的表格:)

为了自己调整所有控件,我建议你使用css_xhtml主题而不是默认的xhtml。

通过这样做假设您的表单是这样的:

<s:form action="add" method="post"> <s:textfield name="contact.firstName" label="Firstname"/> <s:textfield name="contact.lastName" label="Lastname"/> </s:form>

它将呈现为:

<form id="add" name="add" action="add" method="post"> <div id="wwgrp_add_contact_firstName" class="wwgrp"> <div id="wwlbl_add_contact_firstName" class="wwlbl"> <label for="add_contact_firstName" class="label">Firstname:</label> </div> <br /> <div id="wwctrl_add_contact_firstName" class="wwctrl"> <input type="text" name="contact.firstName" value="" id="add_contact_firstName"/> </div> </div> <div id="wwgrp_add_contact_lastName" class="wwgrp"> <div id="wwlbl_add_contact_lastName" class="wwlbl"> <label for="add_contact_lastName" class="label">Lastname:</label> </div> <br /> <div id="wwctrl_add_contact_lastName" class="wwctrl"> <input type="text" name="contact.lastName" value="" id="add_contact_lastName"/> </div> </div> </form>

您现在要做的就是覆盖样式并相应地创建表单,设置它们的样式:)

If you need four columns in a row then you need to fully control the <s> tag or just skip <s> tags and have your own form :)

To align all controls yourself, I would suggest you to use css_xhtml theme instead of default xhtml.

By doing so suppose your form is like this:

<s:form action="add" method="post"> <s:textfield name="contact.firstName" label="Firstname"/> <s:textfield name="contact.lastName" label="Lastname"/> </s:form>

It will be rendered as:

<form id="add" name="add" action="add" method="post"> <div id="wwgrp_add_contact_firstName" class="wwgrp"> <div id="wwlbl_add_contact_firstName" class="wwlbl"> <label for="add_contact_firstName" class="label">Firstname:</label> </div> <br /> <div id="wwctrl_add_contact_firstName" class="wwctrl"> <input type="text" name="contact.firstName" value="" id="add_contact_firstName"/> </div> </div> <div id="wwgrp_add_contact_lastName" class="wwgrp"> <div id="wwlbl_add_contact_lastName" class="wwlbl"> <label for="add_contact_lastName" class="label">Lastname:</label> </div> <br /> <div id="wwctrl_add_contact_lastName" class="wwctrl"> <input type="text" name="contact.lastName" value="" id="add_contact_lastName"/> </div> </div> </form>

All you have to do now is override the style and create your forms accordingly ,style them :)

struts2,如何在不更改主题的情况下更新HTML Struts标签的标准双列表布局(struts2, How to update Standard two-column table layout for the HTML Struts Tags without changing theme)

我正在为我的应用程序使用struts2。 在struts2中,默认情况下在两列表中放置表单,左列中的每个输入字段都有标签,右列中的输入字段(Label #input field#)。 但就我而言,我需要连续四列(Label #input field#Label #input field#)。 有没有办法做到这一点,而不改变我的主题(xhtml)?

我不希望对主题进行任何更改,是否有任何方法可以欺骗每个struts标记的#tr#,#td#标签。

I'm using struts2 for my application. In struts2,by default lays forms out in a two column table with the label for each input field in the left column and the input field in the right column (Label #input field#). But in my case, I need four-column in a row (Label #input field# Label #input field#). is there any way to do this, without changing my theme(xhtml) ?

I don't want any changes to theme, is there any way to cheat auto rendering #tr#,#td# tags for each struts tag.

最满意答案

如果你需要连续四列,那么你需要完全控制<s>标签或只是跳过<s>标签并拥有自己的表格:)

为了自己调整所有控件,我建议你使用css_xhtml主题而不是默认的xhtml。

通过这样做假设您的表单是这样的:

<s:form action="add" method="post"> <s:textfield name="contact.firstName" label="Firstname"/> <s:textfield name="contact.lastName" label="Lastname"/> </s:form>

它将呈现为:

<form id="add" name="add" action="add" method="post"> <div id="wwgrp_add_contact_firstName" class="wwgrp"> <div id="wwlbl_add_contact_firstName" class="wwlbl"> <label for="add_contact_firstName" class="label">Firstname:</label> </div> <br /> <div id="wwctrl_add_contact_firstName" class="wwctrl"> <input type="text" name="contact.firstName" value="" id="add_contact_firstName"/> </div> </div> <div id="wwgrp_add_contact_lastName" class="wwgrp"> <div id="wwlbl_add_contact_lastName" class="wwlbl"> <label for="add_contact_lastName" class="label">Lastname:</label> </div> <br /> <div id="wwctrl_add_contact_lastName" class="wwctrl"> <input type="text" name="contact.lastName" value="" id="add_contact_lastName"/> </div> </div> </form>

您现在要做的就是覆盖样式并相应地创建表单,设置它们的样式:)

If you need four columns in a row then you need to fully control the <s> tag or just skip <s> tags and have your own form :)

To align all controls yourself, I would suggest you to use css_xhtml theme instead of default xhtml.

By doing so suppose your form is like this:

<s:form action="add" method="post"> <s:textfield name="contact.firstName" label="Firstname"/> <s:textfield name="contact.lastName" label="Lastname"/> </s:form>

It will be rendered as:

<form id="add" name="add" action="add" method="post"> <div id="wwgrp_add_contact_firstName" class="wwgrp"> <div id="wwlbl_add_contact_firstName" class="wwlbl"> <label for="add_contact_firstName" class="label">Firstname:</label> </div> <br /> <div id="wwctrl_add_contact_firstName" class="wwctrl"> <input type="text" name="contact.firstName" value="" id="add_contact_firstName"/> </div> </div> <div id="wwgrp_add_contact_lastName" class="wwgrp"> <div id="wwlbl_add_contact_lastName" class="wwlbl"> <label for="add_contact_lastName" class="label">Lastname:</label> </div> <br /> <div id="wwctrl_add_contact_lastName" class="wwctrl"> <input type="text" name="contact.lastName" value="" id="add_contact_lastName"/> </div> </div> </form>

All you have to do now is override the style and create your forms accordingly ,style them :)