aspose file tools*
The moose likes JSF and the fly likes Unable to set Default value after onchange of Combo in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Unable to set Default value after onchange of Combo in JSF" Watch "Unable to set Default value after onchange of Combo in JSF" New topic
Author

Unable to set Default value after onchange of Combo in JSF

Ankit Bhatt
Greenhorn

Joined: May 08, 2010
Posts: 3
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

Joined: Jun 11, 2008
Posts: 23
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.


"Life is good"
Ankit Bhatt
Greenhorn

Joined: May 08, 2010
Posts: 3
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

Joined: Jun 25, 2001
Posts: 16137
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ankit Bhatt
Greenhorn

Joined: May 08, 2010
Posts: 3
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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to set Default value after onchange of Combo in JSF