Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending and receiving xml files using struts

 
Kwstas Gewrgiadis
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

This is my first post.I have some questions regarding struts and xml.
I want to create a web application that sends and receives xml files.
What's the best possible way?I haven't found much regarding a specific question.
We make a request to a remote server by posting some parameters(not xml,but some parameters) and the server replies with an xml string.
And here lies my question:
i)How can I get this xml?
The xml is in string format,therefore I can get it with setter and getter.However the problem is that I do not know the name of the string in order to catch it with a getter.
ii)what's the best possible way to handle xml exchange using struts?

Thanks in advance
 
xsunil kumar
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Web service is better option to sending XML over HTTP. But any how you are using Struts. then you can save that XML as string in one object and that object you can store in request/ session.

On Jsp you can get that String which is nothing but a xml.

-Sunil
 
Kwstas Gewrgiadis
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sunil,

Thanks for the response.
I'm sorry ,I do not quite follow.Let me give you an example:

I have an action which posts input data to one of my actions.There,I get these input parameters with setters(extends ActionSupport) and afterwards I post them to a known url with getters
via an shtml form(basically with a .vm file,I use velocity).Everything works perfect until this point.
Then the server response to my page sending an xml string.How can I get this?
You said to save it as a string in one object.But how?I do not know the name of that string.
I'm sorry if I don't understand something.
Could you please provide me with a small example?

Thanks again for your reply.

Kwstas
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic