• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Trouble using Map with h:selectOneMenu...

 
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the book "Core JavaServer Faces" and in there it says that I can use a plain Map collection with selectItems in a selectOneMenu.

I'm able to get it to work on one app but not another...using the same JSF implementation on the same app server...so naturally I'm completely confused...to say the least.

I'm using Sun's Glassfish V1 and the official JSF 1.2 reference implementation it comes with. I'm not interested in MyFaces or another alternative...I want to stick w/ the built-in faces impl.

Anyhow, I have an enterprise app that has a page w/ this in it:



In the backing-bean, the list is populated like so:



In another app I've done it *exactly* the same way...



...but I get an exception!!



What am I doing wrong? I'm completely stumped. Can I use a Map or not? If no, why did it work once and not twice in *identical* situations!?

Thanks!
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I believe you can populate <h:selectOneMenu> using Map. From the error, it looks like there's a syntax error in your jsp page somewhere.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Theist what ever you want to get or to add that must be belong to Select item class or that type always return List
See this code here


public void setSelectSection(String selectSection) {
this.selectSection = selectSection;
}

public List<SelectItem> getSelectSelectioncatagorey() {
selectSelectioncatagorey = new ArrayList<SelectItem>();
selectSelectioncatagorey.add(new SelectItem("", "Select Catagorey"));
selectSelectioncatagorey.add(new SelectItem("PIN", "PIN"));
selectSelectioncatagorey.add(new SelectItem("PRN", "PRN"));
return selectSelectioncatagorey;
}
 
Ankur Thakur
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what ever you want to get or to add that must be belong to Select item class or that type always return List
See this code here


public void setSelectSection(String selectSection) {
this.selectSection = selectSection;
}

public List<SelectItem> getSelectSelectioncatagorey() {
selectSelectioncatagorey = new ArrayList<SelectItem>();
selectSelectioncatagorey.add(new SelectItem("", "Select Catagorey"));
selectSelectioncatagorey.add(new SelectItem("PIN", "PIN"));
selectSelectioncatagorey.add(new SelectItem("PRN", "PRN"));
return selectSelectioncatagorey;
}
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic