• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Passing parameter to jsp:include with c:set

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,


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



Thanks for the tip. _rt works.
Anfun
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
It's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic