• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to pass xml as hidden parameter from a form  RSS feed

 
Shoba Ramachandran
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 pages, test1.jsp and test2.jsp.
I want to pass xml from test1.jsp to test2.jsp.
I'm not able to pass it, Any help please!
Test1.jsp
----------
<form name="exportform" method="post" action="/test2.jsp">
<input type="hidden" name="xmlString" value="<mapData>hello</mapData>">
</form>
Test2.jsp
---------
<%String xmlString = request.getParameter("xmlString");
out.println(xmlString : " + xmlString);
%>

The output is nothing.How to get this value.
Any help is greatly appreciated, thanks
-Shoba
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect the fact that you have XML information probably isn't a factor here, so I'm moving this to the JSP forum.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a quick question, how are you getting from test1.jsp to test2.jsp? Is there a submit button in the form that has not been displayed here? If you are clicking on a link then the form data won't be transmitted...
DOM
 
Arun Boraiah
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Shoba,
Actually you are getting the complete hidden parameter. To test that you can use below line of code which will display the value to your server console
System.out.println("xmlString : " + xmlString);
the out put will be <mapData>hello</mapData> Which you require.
But When you want to print in the browser. Browser's xml parsers will interpet that xml tags and display you only the value of xml tag. If you test in netscape(version lesser then 4.77) you will find complete xml string printed.
-arun
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!