5

I am using Bootstrap for my UI development. When I use Struts 2 tags for textfield in it, the complete page alignment is destroyed. When I replace the s: (Struts 2 tags) tags with normal tags, it is working fine.

Do I need to include any extra jar?

Roman C
  • 49,761
  • 33
  • 66
  • 176
AJE
  • 51
  • 1
  • 1
  • 2

2 Answers2

2

Struts 2 uses themes while rendering output of the JSP page. You can read more about themes in Struts 2 Themes. To change a default theme put this in the struts.xml

<constant name="struts.ui.theme" value="simple"/>
Roman C
  • 49,761
  • 33
  • 66
  • 176
  • Hi, I have added tag to my struts.xml. I found this is the same like adding theme="simple" in each tags, and the issue with display has gone, but I used xml based validations(Action class name-validations.xml) in my application. If i include 'simple' theme in application those validations are not read. And I observed after removing this theme 'simple', validations are done but page alignment has gone. – AJE Oct 06 '14 at 09:47
  • Hi, I think it has almost done but, tags which all I am giving inside
    is not comes under proper alignment. Below structure I used in my JSPs.
    – AJE Oct 07 '14 at 13:52
2

Solution n.1:

Use the simple theme and write the Bootstrap-compliant HTML on your own:

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

Solution n.2:

Use the Struts2 Boostrap plugin (showcase) and the bootstrap theme and let it automatically generate the Bootstrap-compliant HTML from Struts tags:

<constant name="struts.ui.theme" value="bootstrap" />
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243