Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSF
Search Coderanch
Advance search
Google search
Register / Login
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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSF
selectOneMenu and selectItems; getting null
Stas Melnychenko
Greenhorn
Posts: 14
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have selectOneMenu item on my page
<h:selectOneMenu id="performer" value="#{CreateItem.performer}" > <f:selectItems value="#{CreateItem.performersList}" var="performer" itemLabel="#{performer.login}" itemValue="#{performer}" /> </h:selectOneMenu>
And I have backbean:
private User performer; public User getPerformer() { System.out.println("getPerformer = " + performer); return performer; } public void setPerformer(User performer) { this.performer = performer; System.out.println("getPerformer = " + performer); } private List<User> performersList; public List<User> getPerformersList() { return userService.getUsers(); } public void setPerformersList(List<User> performersList) { this.performersList = performersList; } public void createItem() { System.out.println("Is performer null: " + (performer == null)); System.out.println("Enter " + performer.getId() + " " + description + " " + dueDate); Long creator_id = (Long) SessionAccess.getCurrentSession() .getAttribute("currentId"); System.out.println(creator_id + " " + performer.getId() + " " + description + " " + dueDate); Item item = userService.createItem(creator_id, performer.getId(), description, dueDate); System.out.println("Is item null: " + (item == null)); } I see list in drop box, but performer is always null. What I miss?
Stas Melnychenko
Greenhorn
Posts: 14
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I made some change with same result
<h:selectOneMenu id="performer" value="#{CreateItem.performerId}"> <f:selectItems value="#{CreateItem.performersList}" var="performer" itemLabel="#{performer.login}" itemValue="#{performer.id}" /> </h:selectOneMenu>
private Long performerId; public Long getPerformerId() { System.out.println("performerId = " + performerId); return performerId; } public void setPerformerId(Long performerId) { this.performerId = performerId; System.out.println("performerId = " + performerId); } public void createItem() { System.out.println("performerId = " + performerId); Long creator_id = (Long) SessionAccess.getCurrentSession() .getAttribute("currentId"); Item item = userService.createItem(creator_id, performerId, description, dueDate); System.out.println("Is item null: " + (item == null)); }
And value is still null.
Stas Melnychenko
Greenhorn
Posts: 14
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I figured out, that setter never called.
Stas Melnychenko
Greenhorn
Posts: 14
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I remove immediate=true from my submit button.
Work fine!
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
selectOneMenu
Strange behaviour with h:selectOneMenu value
Trouble with JSF selectOneMenu
JSF keeps displaying old values after Validation Phase fails (ignoring actionListeners settings)
<h:selectOneMenu issue defaulting to specific selectItem
More...