This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with selectManyListbox

 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try naming your method condiments instead of setCondiments.
 
A Saari
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you redeploy the application and bounce the server?
 
A Saari
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic