tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Tang" <sta...@lucent.com>
Subject Re: passing parameters to another JSP page
Date Fri, 20 Jun 2003 15:07:23 GMT
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" <sradzom@web.de>
To: "'Tomcat Users List'" <tomcat-user@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&param2=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


Mime
View raw message