如何禁用窗体的 struts 2 表生成?

2022-01-16 00:00:00 java struts2

Struts 2 自动为它的 <s:form> 标签生成 HTML 表格.我怎样才能禁用它?任何帮助将不胜感激.谢谢.

Struts 2 automatically generate HTML table for it's <s:form> tag. How can I disable it? Any help will be appreciated. Thank You.

推荐答案

Struts2 具有主题生成功能,基于它生成基于表格的 HTMl 代码,其标签默认为 x_html,这是您的情况.您可以通过在页面级别将主题设置为简单或每个标签具有主题属性来避免这种情况,该属性将生成基于 div 的 html 内容

Struts2 have theme generation functionality based on which it generares either Table based HTMl code for its tags default is x_html which is your case . You can avoid this by setting theme as simple on page level or each tags has theme property which will generate div based html contents

<s:form name="test" theme="simple">

或者您可以为整个页面设置主题,如下所示静态值

or you can set theme for entire page as below static value

<s:set name="theme" value="'simple'" scope="page" />

财产

<s:set name="theme" value="%{myTheme}" scope="page" />

您可以通过

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

相关文章