Question

I am currently upgrading from Struts 2.0.11.1 to Struts 2.3.7, but I'm having a problem with the output of Struts tags (like <s:radio>and <s:textarea>. Before, the output of these tags were two <div>'s, one containing the label, and one containing the radiobuttons/textarea. But after I upgraded there is a <br>between the two <div>'s.

Before:

<div id="wwlbl_something_someString" class="wwlbl">
    <label for="something_someString" class="desc">Some label</label>
</div>
<div id="wwctrl_something_someString" class="wwctrl">
    <!--radiobuttons/textarea -->
</div>

After

<div id="wwlbl_something_someString" class="wwlbl">
    <label for="something_someString" class="desc">Some label</label>
</div>
<!-- I don't want this.. -->
<br>
<!-- -->
<div id="wwctrl_something_someString" class="wwctrl">
    <!--radiobuttons/textarea -->
</div>

The jsp:

    <li class="wwgrp flowClear">
        <h3 class="header"><s:text name="something.header"/></h3>
        <ol class="nobullets">
          <s:radio list="yesNoList"
                   label="%{getText('something.text.label')}"
                   name="something.someString"
                   value="something.some"
                   disabled="%{readOnly}"/>
        </ol>
      </li>

@Comment: There are a lot of things in this project that many have never seen before (not in a good way) ;)

Does anyone know if this is something that has changed in Struts, and if so, how to avoid creating the <br>'s?

Was it helpful?

Solution

I actually stumbled across the answer. As an answer to the last comment struts.ui.theme is set to css_xhtml.

http://depressedprogrammer.wordpress.com/2007/04/11/struts-2-form-control-templates/

One quick note, the xhtml_css theme also generates a very worthless <br/> tag between a label and the control which can throw of your entire look, do get rid of this you’ll have to do a .wwgrp br { display: none; } in your CSS stylesheeet.

So I assume doing this will solve the problem, it is something added by struts theme, probably changed when I updated Struts version.

Pointers on how this is usually set up/should be set up is welcomed, as I do not know anything about this.. :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top