• 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

Pass values to XML

 
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Jersey to implement REST Web Services in my project. Currently i am trying a simple application where i post values from a FORM and process it to produce a XML output.

The Resource code is


The create_output_xml.xml page is


When i try to run it, the values get posted and XML page is displayed but with no values.
I knew that i didn't pass the value, but i dont know how to pass these values to the xml so that it'll be displayed in output instead of ${}.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Have you tried setting the corresponding attributes in the servlet request object?
See the javax.servlet.ServletRequest interface API documentation for details on how to set attributes in the reqeust obejct.
Best wishes!
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
^^
So do i need to create XML using JAXB and pass it to client?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I came to think of something:
The output page is not a JSP, so I don't think things like ${description} and ${summary} will be substituted even if you have the corresponding attributes set in the request.
You should use some templating framework, like Apache Tiles http://tiles.apache.org/, or some other mechanism to replace the placeholders with values.
Best wishes!
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
^^

Thanks for the reply...

I got further simpler way to achieve that. Just created a bean with all values to be added in XML and pass it as a Object. Then, the Jersey will take care of the rest. It created the XML!!!
 
reply
    Bookmark Topic Watch Topic
  • New Topic