SelectOneMenu rendering SelectItems List twice

Hi All,

I have a bit of a problem I have not been able to track down. I have a JSP that sometimes duplcates my list data in a SelectOneMenu and sometimes the data is only listed once...ie: the list might have selectItem entry values of { All, None } and sometimes {All, None, All, None }.

The SelectOneMenu code is as follows::

<td width="*" class="bodyCopy">

<aa:zoneJSF id="ReleaseZone">

<h:selectOneMenu id="release" styleClass="bodyCopy" value="#{filterBean.selectedRelease}" immediate="true" >

<f:selectItems value="#{filterBean.release}"/>

</h:selectOneMenu>

</aa:zoneJSF>

</td>

I do see the getter on the FilterBean being invoked multiple times, though I don't think that's the problem as I see the "Release" list data always returning only 2 values (never duplicated). So what confuses me is why the values in the list would be duplicated (or rendered more then once).

Incase you were wondering, the <aa:>

tag is for using Ajax Anywhere with JSF tags.

Any leads would be appreciated. I don't think of myself as a JSF newbie, but I'm really beginning to suspect otherwise.

Regards,

~Rob.

[1427 byte] By [Robbio123a] at [2007-11-27 10:17:12]
# 1

I've found this occurs when there is an error on the jsp page. Is there any exception in the server log after this occurs (the double list)?

..\W

wbossonsa at 2007-7-28 15:50:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Well - the only thing found in my catalina log after the duplicate list appears is as follows:

Jul 11, 2007 2:53:59 PM reports.util.ReportsConfig getSessionExpireTime

INFO: -- Config value found for Session Timeout was: 12

Jul 11, 2007 2:53:59 PM org.apache.myfaces.renderkit.html.util.ReducedHTMLParser parse

WARNING: Invalid tag found: unexpected input while looking for attr name or '/>' at line 4430

Jul 11, 2007 2:53:59 PM org.apache.myfaces.renderkit.html.util.ReducedHTMLParser parse

WARNING: Invalid tag found: unexpected input while looking for attr name or '/>' at line 6029

Jul 11, 2007 2:53:59 PM org.apache.myfaces.renderkit.html.util.ReducedHTMLParser parse

WARNING: Invalid tag found: unexpected input while looking for attr name or '/>' at line 7544

Jul 11, 2007 2:53:59 PM org.apache.myfaces.shared_tomahawk.taglib.UIComponentTagUtils setActionListenerProperty

SEVERE: Component root has invalid actionListener value:

I get those 3 warning messages frequently, so I cant tell for certain if that's the cause...though it woul be nice to be able to track down those minor issues.

~Rob.

Robbio123a at 2007-7-28 15:50:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Depending on how you set your getter up and what your needs are, you could have the getter only populate the bean if it is empty or if it is a dynamic list that changes throughout the program you could add a list.clear() to the beginning of your get method. If these don't work, posting some of your backing beans code might be helpful in finding the solution

jco1323a at 2007-7-28 15:50:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

It's not clear to me why I'd need to do a list.clear() in the backing bean, but I'll give it a shot. I don't know that I'd need to do this as the getter always returns the correct number of elements in the list.

But by way of disclosing more information about my backing bean with regards to the release info, see below:

// From the FilterBean object

private SelectItem[] release = null;

public FilterBean()

{

setupReleaseList("All");

SessionUtil.getSession().setAttribute("filterBean", this);

}

public SelectItem[] getRelease()

{return(release);}

public String setupReleaseList( String _version )

{

StringBuffer xml = new StringBuffer();

xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");

xml.append("<options><option value='All'>All</option><option value='N''>None</option>");

this.release = new SelectItem[2];

this.release[0] = new SelectItem("A","All");

this.release[1] = new SelectItem("N","None");

xml.append("</options>");

return (xml.toString());

}

I started kicking around an idea of using xml, but at htis point It's probably a dead end.

Robbio123a at 2007-7-28 15:50:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...