With state-of-the-art JSF taglibraries, you shouldn't have to be worrying about whether the listbox is populated using JSON or not - the whole process is transparent, whether using the basic static listbox or one that's populated via AJAX. You define a listbox control using the JSF tag, define a list model in the backing bean, add some AJAX rules to the page definition if desired, and the data transfer takes care of itself.
On the other hand, if you're trying to adapt an existing JSON data source servlet, JSF doesn't directly support that. You'd either need to provide your own client-side JSON listbox code or make the JSF backing bean act as a proxy to the JSON datasource and use a regular (or AJAX-enhanced) JSF listbox on the client.
An IDE is no substitute for an Intelligent Developer.
Joined: Dec 30, 2007
It has nothing to do with JSF Actually,I am using json-lib in my bean class. ie I can create objects of JSONArray,JSONobject and can serialise data and all defined in JSON.org site.
I just want my servlet to return a JSON object containing all the options and its values. I used something like JSONObject json=new JSONObject(); json.put("Alabama","0"); json.put("India","0"); problem is that i wont be able to access it correctly.I want a technique to resolve this. I tried creating an objectArray and putting array to another JSON but that hadnt worked for me.
As I mentioned before, the JSF selection listbox controls expect to be totally controlled by JSF including the data transfers of the list and its selection, so to use JSON, you'd need to use a non-JSF control or else do the JSON stuff inside the JSF backing bean instead of in the client's browser.