• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pass values to XML

 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • 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 ${}.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic