This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In my requirement, command button should be in disable state initially, and it will be enabled on change of dropdown box. Here the issue is after enabling the button, it’s not invoking its action method on click. But its works good if I never disable the button. I am enabling the button through <f: ajax render property. Is it a issue with <f: ajax. I have pasted the code snippets below, Please help me what I am missing in that. Thanks in advance. [i have tried immediate="true" also]
This is my XHTML:
This is my ActionBean
Joined: Apr 14, 2011
is the issue is much tricky ?
Joined: Apr 14, 2011
Enabled command button invokes its action method when i change scope from RequestScoped to SessionScoped. Why is it so? what is with ajax and scope?
In Request scope, the data is destroyed at the end of each request and has to be re-created when the next request is made. This can be a problem when doing postbacks, especially when using things like datatables, because the tablemodel that maintains the cursor for iterating through the data rows is destroyed, as is the datamodel itself.
In Session scope, the data is retained between requests, so that's not a problem.
These two scopes are an integral part of J2EE and have been for years.
Session scope, however, is basically forever - or at least until the session scope object is detached from the HttpSession object (or the session is destroyed). Since JSF doesn't really support destruction of scope objects, that means that you can end up with a lot of objects cluttering up your app environment and wasting resources.
In JSF2, the View scope was added. Unlike Request and Session scopes, it's not directly provided by the J2EE server. Instead, it's a session object with a built-in destruct mechanism that removes the object from the session once you transfer to another View.
Maybe I'm misunderstanding the syntax on this, since I don't use f:ajax I'm more of an ICEfaces kind of guy, but should the render attribute be "rendered?" And should it be set to "true" or "false" such that changing it dynamically would mean tying it to the EL?
With the bean having some code to change the value of the showButton member based on a value change listener attached to the dropdown box?