Reputation: 2109
i found a similar problem like this: Struts2 form elements but no answer is given until now. So here i post my difficulties with a vengeance.
I am using Struts2 with version 2.1.6. When I leave the input elements such as <s:textfield>
, <s:textarea>
, etc. of a <s:form>
with the default theme, the elements are rendered as:
<tr>
<td class="tdLabel"><label for="firstname" class="label">Firstname:</label></td>
<td><input type="text" name="firstname" id="firstname"/></td>
</tr>
<tr>
<td class="tdLabel"><label for="lastname" class="label">Lastname:</label></td>
<td><input type="text" name="lastname" id="lastname"/></td>
</tr>
Now if i want to add something, say an html label, between the two elements, the result gets messed up as described in the related question above.
Another problem is: for the <s:checkbox>
item, it is just not possible to add an extra title. For example, this tag
<s:checkbox id="defaultprinter" name="defaultprinter" key="lbl.defaultprinter"/>
is rendered as:
<tr>
<td valign="top" align="right"></td>
<td valign="top" align="left">
<input type="checkbox" name="defaultprinter" value="true" checked="checked" id="defaultprinter"/> <label for="defaultprinter" class="checkboxLabel">Default Printer</label> </td>
</tr>
By only setting the attributes of <s:checkbox>
, i can't add any text to the first <td>
shown above (here it is empty!).
I don't know if the above rigid UI problems can be solved or there is any workarounds somewhere.
Thanks in advance.
Upvotes: 0
Views: 697
Reputation: 2223
try using Display tag or JQuery using both of these framewok can be used to create great (flexible) GUI
Upvotes: 0
Reputation: 75996
Just switch your theme. The extra (X)HTML tags are generated because of are using (probably) the xhtml theme. If you want to tweak it, you just use the simple theme and write the surrounding tags yourself. You can do that for the full form, or for some individual tags. You can even write your own themes, if you like.
Upvotes: 1