Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSF and the fly likes Strange selectOneListbox problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Strange selectOneListbox problem" Watch "Strange selectOneListbox problem" New topic
Author

Strange selectOneListbox problem

Ian Dunsirn
Ranch Hand

Joined: May 25, 2006
Posts: 36
I am having the weirdest problem. I have a page with some components, one of which is a button. This button was working fine until I put in a selectOneListbox, calling it's listener method like a pro.

I put in the selectOneListbox and suddenly the button doesn't seem to work, not callings its method.

I have included the jsp code. The listener method is just three debug lines telling me that it was called.

The strange thing is, if I replace the f:selectItems with an empty list, things seem to work fine.

Can anyone point out what I may be missing here? All my beans are defined and populated.

<h:form>
<f:verbatim>
<p>  
</f:verbatim>

<hutputText value="Add new Issue for #{prjsys.projectSystemCode} : #{prjsys.projectSystemTitle}"
style="font-weight : bold" rendered="#{passData.passAction == 'Add'}"/>

<hutputText value="Edit Issue for #{prjsys.projectSystemCode}: #{prjsys.projectSystemTitle}"
style="font-weight : bold" rendered="#{passData.passAction == 'Edit'}"/>

<f:verbatim>
<div id="appFooter"></div>
<br>   
</f:verbatim>

<hutputText value="Please do not enter any sensitive data." style="color : red; font-weight : bold"/>
<f:verbatim><br></f:verbatim>

<h:panelGrid columns = "3">
<hutputText value="Issue #"/>
<hutputText value="New Issue" rendered="#{passData.passAction == 'Add'}"/>
<hutputText value="#{thisIssue.issueId}" rendered="#{passData.passAction == 'Edit'}"/>
<hutputText value=""/>

<hutputText value="Title:"/>
<h:inputText id="newTitle" value="#{thisIssue.title}" size="107"/>
<h:message for="newTitle" style="color : red; font-weight : bold"/>

<hutputText value="Issue Description:"/>
<h:inputTextarea id="newDescription" value="#{thisIssue.description}" rows="5" cols="80"/>
<h:message for="newDescription" style="color : red; font-weight : bold"/>
</h:panelGrid>

<f:verbatim>
<div id="appFooter"></div>
<br>  
</f:verbatim>

<hutputText value="Status:" style="padding: 0px 100px 0px 0px"/>
<h:selectOneListbox id="newStatus" size="1" value="#{thisIssue.status}" immediate="true">
<f:selectItems value="#{dropDown.statusList}"/>
</h:selectOneListbox>

<h:commandButton image="images/AddButton.gif" action="#{issueListener.addAttachment}"/>
<hutputText value=" Add new attachment(s)"/>

<f:verbatim>
<div id="appFooter"></div>
<br>   
</f:verbatim>
</h:form>
Ian Dunsirn
Ranch Hand

Joined: May 25, 2006
Posts: 36
I am such a newb. I figured out that the problem lies in my command button. I put in the attribute immediate="true" and everything works like it should.
 
GeeCON Prague 2014
 
subject: Strange selectOneListbox problem