Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

param not sent by <jsp:forward ......

Status
Not open for further replies.

lowbk

Technical User
Nov 26, 2001
162
SG
I'm using <jsp:forward> to transfer control to from one jsp to another jsp but somehow the param isn't transferred.

========parent.jsp=========
<%
String Mergedxml = &quot;testing123&quot;;
System.out.println(Mergedxml);
//the above is able to print out &quot;testing123&quot;
%>
<jsp:forward page=&quot;child.jsp&quot;>
<jsp:param name=&quot;Mergedxml&quot; value=&quot;<%=Mergedxml %>&quot; />
</jsp:forward>


=========child.jsp===========
<%
String Mergedxml=request.getParameter(&quot;Mergedxml&quot;);
System.out.println(&quot;mergedxml=&quot; + Mergedxml);
//don't know why the above, will print out that mergedxml=null
%>
==================================

if I used &quot;teststring&quot; instead of &quot;<%= Mergedxml %>&quot; in parent.jsp, it will show &quot;mergedxml = teststring&quot; in child.jsp
I'd also tried copying Mergedxml to another string in parent.jsp and then passing that copied string, but also failed.

any kind soul pls advise what could be the cause of the error? configuration problem? variable naming problem?
or is there an alternative?
 
I managed to trace what went wrong but still cannot resolve.
========parent.jsp (ignore the above parent.jsp)=========
<%
String Mergedxml = &quot;<&quot;+&quot;?xml-stylesheet href='AllTestResult1.xsl' type='text/xsl'?&quot;+&quot;>&quot;+&quot;testing123&quot;;

System.out.println(Mergedxml);
//the above is able to print out the whole string
%>
<jsp:forward page=&quot;child.jsp&quot;>
<jsp:param name=&quot;Mergedxml&quot; value=&quot;<%=Mergedxml %>&quot; />
</jsp:forward>
===============================
child.jsp (see above)
================================
in the above parent.jsp, once it reaches child.jsp, Mergedxml is null. but if i remove the &quot;<?xml-...&quot;, leaving only &quot;testing123&quot;, the child.jsp will be able to capture &quot;testing123&quot;. So I believe the error lies in the &quot;<?xml....&quot; but what?

any kind soul pls advise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top