This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I have a XML page where i enter values(price,author,title) of various book and I have to retrieve values of 1 book at a time .. How do i get this done ?? i am new to jsf i tried using onsubmit such that when we click the button the values need to be updated
like for the first i get
title=ABC price=30$ author =abc and onsubmit it should become
title=PQR price = 20$ author = twg again on submit
title= GTU price = 40$ author = tyu .
Right now i get all the values in same page but i want it to come one after the other while onsubmit.
I wrote a function and made it display only title=ABC price=30$ author =abc
and upon refreshing page new contents get loaded title=PQR price = 20$ author = twg
but i want it work when i press a button instead of it changing on refresh .
In the case where JSF is used as part of an XML upload-and-process function, you would normally use one of the file upload controls to manage the actual upload process. The file upload controller would copy the incoming data to a temporary location and return access to that data. That's the same basic process regardless of whether your uploaded data was XML, straight text, or even binary files like PDFs and images. In fact, the only real difference between JSF's management of file uploads and vanilla J2EE uploading is that the actual processing of the uploaded data occurs in the action method of the commandButton that submits the form with the file upload(s) on it. Or, in the case of AJAX-controlled uploads, instead of an action method, it would be an AJAX listener method (which is almost the same thing).
Once the app has access to the uploaded data, it may do anything it wants to with it. You can use the Apache digester to reduce the received XML to Java objects. Or, for that matter, you can use SAX, STAX, JAXB, brute-force, some of the popular ORM implementations - in fact, there are more ways to parse XML in Java than I can easily remember. Anything that works in a stand-alone Java app can be used (as long as it doesn't spawn threads). Which means that you could offload that logic into a POJO bean and test it without having to launch a full-scale webapp server or use JSF-specific functionality.
Once the XML has been reduced to Java objects, of course, JSF will be able to use them just like it does any other Java objects.