Reputation: 865
I have a problem when using UI tags (ex: <s:select />
) in Struts.
I use the default theme in a form (theme='xhtml'
)
When using
<s:select label="FIELD1" ....../>
Struts2 will generate the HTML code shown below (I skipped the non-important portions)
<table>
<tr>
<td>FIELD1:</td>
<td> <select ...... > </td>
</tr>
</table>
When using
<s:select label='' .....>
the generated HTML code is shown below:
<table>
<tr>
<td>:</td>
<td> <select ...... > </td>
</tr>
</table>
In the HTML code generated by Struts2, you still see a colon in the label field in table.
When using
<s:select .....>
If I do not use a label attribute, Struts2 will generate the HTML code shown below:
<table>
<tr>
<td></td>
<td> <select ...... > </td>
</tr>
</table>
In the HTML code generated by Struts2, you will see the label text is completely empty.
What I wish is, I set the attribute label=''
, and the label text in the HTML code generated by Struts2 is empty (no colon).
How do I do this?
Upvotes: 0
Views: 3624
Reputation: 10555
Use the labelSeparator
attribute to empty string and your requirement would be satisfied. Please refer the document for other attribute references for <s:select>
:
http://struts.apache.org/2.x/docs/select.html
Upvotes: 1
Reputation: 23587
This is due to the xhtml
theme which you are using and based on that Struts2 tags are generating the HTML output for you.
here is what happening inside Struts2 free marker template which is being used to generate the HTML output.
${parameters.labelseparator?default(":")?html}<#t/>
so what happening when you have no labelseparator it is using default seperator which Struts2 internally using :
So either you should provide labelSeparator
as said by James
and for better control of the output use simple theme and defined/design page as per your choice.
Upvotes: 0