It is very simple to create a form using struts2. Default theme is xhtml which supports errorfields and tooltips. I think the main disadvantage is that each textfield is placed in a separate row by default.
Label1: TextField1
Label2: TextField2
I would like to have many columns in one row.
Label1: TextField1 Label2: TextField2
I tried to use simple theme at the beginning but I found out that tooltips are not supported with a simple theme. I found the solution at http://www.vitarara.org/cms/struts_2_cookbook/creating_a_theme. It is a great page but the page is a little bit outdated,
I am using struts2 2.0.11. I copied qxhtml theme from sample application on vitavara page into my project. I succeed to put many columns in one row but there was a problem with datetimepicker. I found out that I have to modified the file datepicker.ftl to make things working. There is a change in a second row. It looks like in the old struts2 version there was a /simple/datepicker.ftl instead of /simple/datetimepicker.ftl.
<#include “/${parameters.templateDir}/${parameters.theme}/controlheader.ftl” />
<#include “/${parameters.templateDir}/simple/datetimepicker.ftl” />
<#include “/${parameters.templateDir}/qxhtml/controlfooter.ftl” />
You can use labelcolspan and inputcolspan to control the size of particular object. Example: the number of columns in a separate row is 8 columns. If we would like to put only one textfield in this row and if the label should take 1/4 then we would put 2 (2/8=1/4) for labelcolspan and 6 (6/8=3/4) for inputcolspan. Please check the code below.
IMPORTANT: Do not forget to use template=”datepicker” inside s:datetimepicker tag.
<s:datetimepicker template=”datepicker” label=”MyDate” theme=”qxhtml”>
<s:param name=”labelcolspan” value=”%{3}”/>
<s:param name=”inputcolspan” value=”%{4}”/>
</s:datetimepicker>







