I am evaluating JSF as a possible alternative to JSPs with Struts and have run in to a problem that might be a design flaw in JSF.
Consider a simple page with one edit box, one drop-down menu and one submit button. When the menu changes the edit box should display that item's description. You can then change it and submit the change. Simple as pie.
A few gymnastics are required to do this.
1) The menu (single-select drop-down list) has to be "immediate mode" to skip validation when the menu item changes.
2) Add a value-change event handler that will change the variable the edit box's is bound to so that it has a description for the newly selected
item. The variables all live in a session scope bean so they stick around.
3) You must auto-submit-on-change your menu since the event won't fire until there is a submit.
4) This event is a refresh from the server so you do not want to update bound variables from the incoming request values; to do that you must call renderResponse() on the Faces context at the end of your event handler.
The effort required is very small once you know the pattern but there's a problem: the edit box DOES NOT update when you change the menu. The funny thing is it DOES update if you make it read-only or use a read-only component like output text. Moreover, it DOES update if you navigate to another page and come back. Seems to me the JSF "engine" has issues.
Any JSF experts out there that can explain why edit boxes do not update when changed on the server and the page is re-rendered? I am willing to award all of my Duke Dollars to anybody who can answer this:)
No replies. Figures given that JSF is a noob on the technology scene. I can always trace the code in the reference implementation to see what's going on I suppose.