• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to set Default value after onchange of Combo in JSF

 
Ankit Bhatt
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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.
 
Vaibhav Mittal
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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
  • 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"?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic