Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing parameter to jsp:include with c:set

 
anfun wong
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I pass a parameter using only standard tags (not snipplets) to a dynamically included jsp? Here is what I have tried:

In parent jsp:


In child jsp, when I try to access productId, I got a servlet exception.

Although the following works:
and able to access productId in child JSP.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by anfun wong:

In child jsp, when I try to access productId, I got a servlet exception.


Do you not think it might be helpful to include the details of said exception?
 
anfun wong
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is for JSP 1.2. Container is WSAD 5.1.2.

Actually just got a little further - no exception now. But the value is not being passed in. It's empty. The code is still the same though, just a server restart.

Thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume that you are using JSTL 1.0 as you are using JSP 1.2? (Unless you have a really good reason not to, an upgrade to JSP 2.0/JSTL 1.1 will make you a much happier person).

If so, are you using the _rt JSTL URI's?
 
anfun wong
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,


If so, are you using the _rt JSTL URI's?


Thanks for the tip. _rt works.
Anfun
 
Tushar Madhukar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Bear edit: thread hi-jack removed. Start a new thread for new topics.]
[ September 09, 2006: Message edited by: Bear Bibeault ]
 
Stefan Evans
Bartender
Posts: 1691
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I probably would have tried turning the runtime expression <%= productBean.getId() %> into a proper EL expression - ie


[ September 10, 2006: Message edited by: Stefan Evans ]
 
anfun wong
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stefan,

Yes you are right. I did have to use Java because I'm only patching this JSP and the existing variable productBean is not available to the tags.

Is there a good document illustrating the various name spaces involved in JSP and JSTL and how they correlate and interact, and how to communicate variables among them? I have only found pieces of info here and there.

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic