• 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

Unable to set Default value after onchange of Combo in JSF

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have JSF combo tag like


This combo is dependent on another combo selection.
I want to set default value based on the previous combo's selected value.
So in my Java code , I set like this



but it doesnt set the default value, even I can see proper value in Logs.
I have observed that whatever value I select manually, it is setted default every time.

Please help.

Thanks in Advance.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You also need to reRender this component on selection of the previous drop down. Assign an id to this select one menu that you have here and use the reRender attribute on the previous drop down and give the id you just gave as its value. Something like reRender="theidname". I think that should work fine.
 
Ankit Bhatt
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vaibhav Mittal wrote:You also need to reRender this component on selection of the previous drop down. Assign an id to this select one menu that you have here and use the reRender attribute on the previous drop down and give the id you just gave as its value. Something like reRender="theidname". I think that should work fine.



Sorry, but I dont understand "reRender", see, my managed bean scope is "request" so it will refresh the page on each request, right? so in case of "onchange" of Drop down also it will refresh the whole page, right? so is it required to use "reRender"?
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankit Bhatt wrote:

Vaibhav Mittal wrote:You also need to reRender this component on selection of the previous drop down. Assign an id to this select one menu that you have here and use the reRender attribute on the previous drop down and give the id you just gave as its value. Something like reRender="theidname". I think that should work fine.



Sorry, but I dont understand "reRender", see, my managed bean scope is "request" so it will refresh the page on each request, right? so in case of "onchange" of Drop down also it will refresh the whole page, right? so is it required to use "reRender"?



Vaibhav was referring to a feature of the RichFaces tagset that uses AJAX to do partial page rendering, not a full-page re-render like you're attempting.

JSF requires session-scope beans in places where other frameworks can get by with request-scope beans. That has to do with the JSF postback functionality and the fact that request-scope beans are destroyed and after use and re-created from scratch on the next request, losing things like datamodel objects in the process.
 
Ankit Bhatt
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:

Ankit Bhatt wrote:

Vaibhav Mittal wrote:You also need to reRender this component on selection of the previous drop down. Assign an id to this select one menu that you have here and use the reRender attribute on the previous drop down and give the id you just gave as its value. Something like reRender="theidname". I think that should work fine.



Sorry, but I dont understand "reRender", see, my managed bean scope is "request" so it will refresh the page on each request, right? so in case of "onchange" of Drop down also it will refresh the whole page, right? so is it required to use "reRender"?



Vaibhav was referring to a feature of the RichFaces tagset that uses AJAX to do partial page rendering, not a full-page re-render like you're attempting.

JSF requires session-scope beans in places where other frameworks can get by with request-scope beans. That has to do with the JSF postback functionality and the fact that request-scope beans are destroyed and after use and re-created from scratch on the next request, losing things like datamodel objects in the process.



But what should I do to resolve this issue?
Please help...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic