• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Render the contents from xml file to jsf page

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
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 .

Thanks in advance
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Rakesh! Could you please read our Display Name rules (http://www.javaranch.com/name.jsp) and adjust your display name? Thanks.

I'm afraid I don't quite understand your question. Are you attempting to upload and process an XML data file?
 
Rakesh Jayaramaiah
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Welcome to the JavaRanch, Rakesh! Could you please read our Display Name rules (http://www.javaranch.com/name.jsp) and adjust your display name? Thanks.

I'm afraid I don't quite understand your question. Are you attempting to upload and process an XML data file?



Yes I am trying to Upload and process my XML data file . Please help me how would i do that
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your co-operation, Rakesh!

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic