You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alan Tang <st...@lucent.com> on 2003/06/20 12:03:10 UTC
passing parameters to another JSP page
Hi,
Any help would be highly appreciated!
I'm wondering why it's NOT working passing parameters to another jsp page.
I'm using Tomcat 4.0
Here is the sample jsp pages I used:
Called.html:
<html>
<head></head>
<body>
<jsp:include page="callee.jsp" />
<jsp:param name="param2" value="value2" />
<jsp:param name="param3" value="value3" />
</jsp:include>
Caller:
param1: <%= request.getParameter("param1") %>
param2: <%= request.getParameter("param2") %>
param3: <%= request.getParameter("param3") %>
</body>
</html>
Here is the JSP page being called:
<html>
<head></head>
<body>
Callee:
param1: <%= request.getAttribute("param1") %>
param2: <%= request.getParameter("param2") %>
param3: <%= request.getParameter("param3") %>
</body>
</html>
If the caller is called with the URL:
http://135.252.32.142/SIX_XML/scriptJsp/caller.jsp?param1=a¶m2=b
the expected output would be:
Callee:
param1: a
param2: value2
param3: value3
Caller:
param1: a
param2: b
param3: null
The issue is that I always get wrong result with Tomcat 4.0:
Callee: param1: a param2: b param3: null
Caller: param1: a param2: b param3: null
Could anybody tell me what's wrong here?
Does Tomcat need a special configuration to support passing parameters
to another JSP page, or I need to use a latter version of Tomcat?
Thanks much!
-----
Alan S. Tang
Lucent Technologies
stang1@lucent.com
Re: passing parameters to another JSP page
Posted by Alan Tang <st...@lucent.com>.
Stefan,
Thanks so much for your response!
It works.
I spent almost a whole day trying to figure it out but failed!
RGS,
Alan Tang
----- Original Message -----
From: "Stefan Radzom" <sr...@web.de>
To: "'Tomcat Users List'" <to...@jakarta.apache.org>
Sent: Friday, June 20, 2003 9:56 PM
Subject: RE: passing parameters to another JSP page
There is a little typo in your <jsp:include> which screws up the rest of
your jsp. For your include-action you use an empty-element tag (ending with
"/>") that by definiton contains no child elements. Therefore, the params do
not belong to the include and are never passed on to the included jsp.
Use the corrected code
<jsp:include page="callee.jsp">
<jsp:param name="param2" value="value2" />
<jsp:param name="param3" value="value3" />
</jsp:include>
and everything should work fine.
Stefan
> -----Original Message-----
> From: Alan Tang [mailto:stang1@lucent.com]
> Sent: Friday, June 20, 2003 12:03 PM
> To: tomcat-user@jakarta.apache.org
> Subject: passing parameters to another JSP page
>
>
> Hi,
> Any help would be highly appreciated!
> I'm wondering why it's NOT working passing parameters to
> another jsp page.
> I'm using Tomcat 4.0
> Here is the sample jsp pages I used:
> Called.html:
> <html>
> <head></head>
> <body>
>
> <jsp:include page="callee.jsp" />
> <jsp:param name="param2" value="value2" />
> <jsp:param name="param3" value="value3" />
> </jsp:include>
>
> Caller:
> param1: <%= request.getParameter("param1") %>
> param2: <%= request.getParameter("param2") %>
> param3: <%= request.getParameter("param3") %>
>
> </body>
> </html>
>
> Here is the JSP page being called:
>
> <html>
> <head></head>
> <body>
> Callee:
> param1: <%= request.getAttribute("param1") %>
> param2: <%= request.getParameter("param2") %>
> param3: <%= request.getParameter("param3") %>
> </body>
> </html>
>
> If the caller is called with the URL:
>
> http://135.252.32.142/SIX_XML/scriptJsp/caller> .jsp?param1=a¶m2=b
>
> the expected output would be:
> Callee:
> param1: a
> param2: value2
> param3: value3
>
> Caller:
> param1: a
> param2: b
> param3: null
> The issue is that I always get wrong result with Tomcat 4.0:
> Callee: param1: a param2: b param3: null
> Caller: param1: a param2: b param3: null
> Could anybody tell me what's wrong here?
> Does Tomcat need a special configuration to support passing parameters
> to another JSP page, or I need to use a latter version of Tomcat?
> Thanks much!
> -----
> Alan S. Tang
> Lucent Technologies
> stang1@lucent.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: passing parameters to another JSP page
Posted by Stefan Radzom <sr...@web.de>.
There is a little typo in your <jsp:include> which screws up the rest of
your jsp. For your include-action you use an empty-element tag (ending with
"/>") that by definiton contains no child elements. Therefore, the params do
not belong to the include and are never passed on to the included jsp.
Use the corrected code
<jsp:include page="callee.jsp">
<jsp:param name="param2" value="value2" />
<jsp:param name="param3" value="value3" />
</jsp:include>
and everything should work fine.
Stefan
> -----Original Message-----
> From: Alan Tang [mailto:stang1@lucent.com]
> Sent: Friday, June 20, 2003 12:03 PM
> To: tomcat-user@jakarta.apache.org
> Subject: passing parameters to another JSP page
>
>
> Hi,
> Any help would be highly appreciated!
> I'm wondering why it's NOT working passing parameters to
> another jsp page.
> I'm using Tomcat 4.0
> Here is the sample jsp pages I used:
> Called.html:
> <html>
> <head></head>
> <body>
>
> <jsp:include page="callee.jsp" />
> <jsp:param name="param2" value="value2" />
> <jsp:param name="param3" value="value3" />
> </jsp:include>
>
> Caller:
> param1: <%= request.getParameter("param1") %>
> param2: <%= request.getParameter("param2") %>
> param3: <%= request.getParameter("param3") %>
>
> </body>
> </html>
>
> Here is the JSP page being called:
>
> <html>
> <head></head>
> <body>
> Callee:
> param1: <%= request.getAttribute("param1") %>
> param2: <%= request.getParameter("param2") %>
> param3: <%= request.getParameter("param3") %>
> </body>
> </html>
>
> If the caller is called with the URL:
>
> http://135.252.32.142/SIX_XML/scriptJsp/caller> .jsp?param1=a¶m2=b
>
> the expected output would be:
> Callee:
> param1: a
> param2: value2
> param3: value3
>
> Caller:
> param1: a
> param2: b
> param3: null
> The issue is that I always get wrong result with Tomcat 4.0:
> Callee: param1: a param2: b param3: null
> Caller: param1: a param2: b param3: null
> Could anybody tell me what's wrong here?
> Does Tomcat need a special configuration to support passing parameters
> to another JSP page, or I need to use a latter version of Tomcat?
> Thanks much!
> -----
> Alan S. Tang
> Lucent Technologies
> stang1@lucent.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: passing parameters to another JSP page
Posted by Mike Curwen <gb...@gb-im.com>.
Don't make the opening jsp:include tag a singleton.
You have :
<jsp:include page="callee.jsp" />
it should be:
<jsp:include page="callee.jsp" >
> -----Original Message-----
> From: Alan Tang [mailto:stang1@lucent.com]
> Sent: Friday, June 20, 2003 5:03 AM
> To: tomcat-user@jakarta.apache.org
> Subject: passing parameters to another JSP page
>
>
> Hi,
> Any help would be highly appreciated!
> I'm wondering why it's NOT working passing parameters to
> another jsp page.
> I'm using Tomcat 4.0
> Here is the sample jsp pages I used:
> Called.html:
> <html>
> <head></head>
> <body>
>
> <jsp:include page="callee.jsp" />
> <jsp:param name="param2" value="value2" />
> <jsp:param name="param3" value="value3" />
> </jsp:include>
>
> Caller:
> param1: <%= request.getParameter("param1") %>
> param2: <%= request.getParameter("param2") %>
> param3: <%= request.getParameter("param3") %>
>
> </body>
> </html>
>
> Here is the JSP page being called:
>
> <html>
> <head></head>
> <body>
> Callee:
> param1: <%= request.getAttribute("param1") %>
> param2: <%= request.getParameter("param2") %>
> param3: <%= request.getParameter("param3") %>
> </body>
> </html>
>
> If the caller is called with the URL:
>
> http://135.252.32.142/SIX_XML/scriptJsp/caller> .jsp?param1=a¶m2=b
>
> the expected output would be:
> Callee:
> param1: a
> param2: value2
> param3: value3
>
> Caller:
> param1: a
> param2: b
> param3: null
> The issue is that I always get wrong result with Tomcat 4.0:
> Callee: param1: a param2: b param3: null
> Caller: param1: a param2: b param3: null
> Could anybody tell me what's wrong here?
> Does Tomcat need a special configuration to support passing
> parameters to another JSP page, or I need to use a latter
> version of Tomcat? Thanks much!
> -----
> Alan S. Tang
> Lucent Technologies
> stang1@lucent.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org