jQuery in Action, 2nd edition*
The moose likes JSP and the fly likes XML -JSP transformation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "XML -JSP transformation" Watch "XML -JSP transformation" New topic
Author

XML -JSP transformation

Prash Singh
Ranch Hand

Joined: Aug 23, 2009
Posts: 103

Dear All,

I am really having trouble in solving this issue.
I have not used xml for displaying purpose, but the requirement wants me to do so.
I have an xml which is to be displayed as an Html/JSP form. Somehow I managed to do so using xsl.
The form is good enough to send data to server. The problem is to retrieve data back in to the form.
I dont know how to do it. If on my jsp I update my xml doc used for displaying with retrieved values,
then I am afraid, It will be displayed to other clients as well .


Please help me regarding this .




Thanks in advance.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18708
    
    8

So you're generating HTML, just like with a normal JSP. Are you saying you don't know how to write HTML which can send data back to the server? If so, you should really go back and learn HTML before messing around with XML and so on, because that's one of the first things you learn about HTML when writing a web application.

The question isn't anything to do with XML, so I'm going to move it to the JSP forum.
Prash Singh
Ranch Hand

Joined: Aug 23, 2009
Posts: 103

Dear Paul,

I am sorry for not being so clear about my question.
I have to generate an HTML form using java. I am successful in generating it via xml using xsl.
The form is also able to send data to a servlet for further processing.
The problem I am facing is how to populate same form ?

If I somehow modify xml file used for displaying form , then for any other client using that form will
show all the form fields populated.(I Guess)

So I want to know exactly what is going to happen and how can i avoid this situation
?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18708
    
    8

Okay. Your XSLT is transforming some input document which is XML? Then you populate the form by putting the appropriate data into that XML and having the XSLT put it into the right place.

So yeah, obviously you can't use a hard-coded XML document for this if you want it to contain different data in different circumstances. You'll have to generate the XML somehow.
Prash Singh
Ranch Hand

Joined: Aug 23, 2009
Posts: 103

Dear Paul,


Can you please suggest me the approach I should follow.
Or is there something like library suitable for this functionality.

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18708
    
    8

The approach you should follow? First step: figure out what your requirements are.

You apparently have this XML file, which you haven't said much about. Except that you're using it to generate an HTML form, or something like that. And then you have to fill in this form with data which is customer-specific. Whereas the XML form isn't customer-specific. Am I right?

Anyway that's what I mean by the requirements. Forget about looking for solutions until you have a clear description of the problem.
 
Don't get me started about those stupid light bulbs.
 
subject: XML -JSP transformation