Struts2 form elements UI too rigid

Posted by jscoot on Stack Overflow See other posts from Stack Overflow or by jscoot
Published on 2010-06-10T10:26:07Z Indexed on 2010/06/10 16:02 UTC
Read the original article Hit count: 223

Filed under:
|
|

Hello, i found a similar problem like this: http://stackoverflow.com/questions/2314296/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.

© Stack Overflow or respective owner

Related posts about form

Related posts about struts2