You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Thorhauer, John (Contractor)" <jo...@disa.mil> on 2005/01/27 17:29:11 UTC

bug in SelectTag

Hi,

I think I found a bug in the org.apache.struts.taglib.html.SelectTag class.
NOTE:  I am using the html taglib WITHOUT struts and just using POJOs.  The
problem occured while using struts 1.2.4 release.  I am using the
<html:select> tag several times on a single jsp page.  I found that each
subsequent rendering of the <html:select> tag was appending the body from
the previous usage.  Each body was made up up of different <html:option>
tags.  So for example, if I used 3 <html:select> tags on my page with the
<html:options> that were unique for each <html:select> the rendering of the
page would look something like this:

<select name="optionsOne" multiple="multiple" size="5">
  <option value="yes">yes</option>
  <option value="no">no</option>
</select>

<select name="optionstwo" multiple="multiple" size="5">
  <option value="yes">yes</option>
  <option value="no">no</option>
  <option value="1">1</option>
  <option value="2">2</option> 
</select>

<select name="optionsThree" multiple="multiple" size="5">
  <option value="yes">yes</option>
  <option value="no">no</option>
  <option value="1">1</option>
  <option value="2">2</option> 
  <option value="x">x</option>
  <option value="z">z</option
</select> 

The fix to this seems to be to to add the following at line 307 of the
SelectTag  in the doAfterBody() method just like the IterateTag does:

bodyContent.clearBody();

Once this is added it seems to function properly.  Can this be fixed in the
1.2.6 release?

Thanks,
John Thorhauer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org