开发者

Struts 2 text box arrangment

I want to create a form that contains text boxes as follow. I am using Struts2.

User Name
|Text Box for user name|

mail id
|Text box for mail id|    

<s:textarea name="username" id="username" label="User Name"/>

This is showing:

User name |Text Box for user name|

But I want开发者_C百科 the above format. When I am using validation framework label is shown in italic, I want normal text.


That is because of default struts2 theme factor xhtml which is showing the output html in table structure Change the theme to simple ans use your own css/HTML way to customize the output

crate a struts.properties file and add the following entry

struts.ui.theme=simple

this will change the theme for whole application as struts2 tags will no longer generates HTML/table code for you

else u can override the theme per page basis like

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

alternate way can be what "Steven" suggested


You're in luck. Just add the labelposition="top" attribute to your Struts2 input tags. e.g.,

<s:textfield name="subject"
             label="Subject"
             size="30"
             maxlength="50"
             labelposition="top"
             required="true"/>

As for the italic label, that should be controlled by CSS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜