aspose file tools*
The moose likes JSF and the fly likes Problem with selectManyListbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem with selectManyListbox" Watch "Problem with selectManyListbox" New topic
Author

Problem with selectManyListbox

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
I have a SelectManyListBox Tag. When a user has selected an item, The Tag is supposed to submit the values to the siteList.Condiments Bean, The problem is the setCondiments() method is not getting executed, which means there is no way i can get the values selected from the listbox


The Code segments are

*******************************************************************
<h:selectManyListbox value="#{siteList.condiments}" immediate="true">
<f:selectItems value="#{siteList.condimentItems}"/>
</h:selectManyListbox>
************************************************************************
and the bean segments are

********************************************************************

public void setCondiments(Integer[] newValue) {==> This Segment is not getting Executed

System.out.println("Hello");
condiments = newValue;
}
public Integer[] getCondiments() {
return condiments;


}
Charles McGuire
Ranch Hand

Joined: Jan 18, 2005
Posts: 99
Try naming your method condiments instead of setCondiments.


There's no place like 127.0.0.1
A Saari
Greenhorn

Joined: Mar 31, 2006
Posts: 26
I used an ArrayList to do this...

Amy

<br><br>
Projects List
<h:selectManyListbox id="myselectManyListbox"
value="#{projectsHandler.selectedProjects}"
size="15" >
<f:selectItems id="myselectManyListValues"
value="#{projectsHandler.mySelectManyList}" />
</h:selectManyListbox>

<br><br>


private java.util.List mySelectManyList;
private String[] selectedProjects;

public void setMySelectManyList(java.util.ArrayList a)
{ mySelectManyList = a; }

public void setSelectedProjects(String[] items)
{ selectedProjects = items; }


public String[] getSelectedProjects() { return selectedProjects; }

public java.util.List getMySelectManyList() {

... some code to lm object from session ...

mySelectManyList = lm.getProjectsList();
}
return mySelectManyList;
}
Charles McGuire
Ranch Hand

Joined: Jan 18, 2005
Posts: 99
Hi Amy,

It is not because you used an ArrayList. Note that your method is called selectedProjects, not setSelectedProjects.

I'm 99.9% sure he needs to remove "set" from his method prefix.

"setCondiments" should become "condiments"
Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
I removed the "set" as requested and still it does'nt work. I believe setCondiments is correct as the value #{siteList.condiments} is referencing a bean which has both set and get Methods
Charles McGuire
Ranch Hand

Joined: Jan 18, 2005
Posts: 99
Did you redeploy the application and bounce the server?
A Saari
Greenhorn

Joined: Mar 31, 2006
Posts: 26
hmmm....I think the set and get are correct - isn't that JavaBeans spec stuff?

try taking out

immediate="true"

just a thought...seems to me I had trouble when I did that...

Amy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with selectManyListbox