This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes accessing enclosing jsp's var in included jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "accessing enclosing jsp Watch "accessing enclosing jsp New topic
Author

accessing enclosing jsp's var in included jsp

sunil kumre
Ranch Hand

Joined: Dec 23, 2000
Posts: 64
i'm invoking a jsp inside of this i'm including another jsp at runtime using jsp:include.
Can someone tell how to access a java variable from the enclosing jsp inside this included jsp.
thanks in advance
sunil
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
By placing the variable in the request object via
request.setAttribute()
and then retreiving it with request.getAttibute() in the other JSP.
This is for dynamic includes, BTW, not for static ones.


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
 
GeeCON Prague 2014
 
subject: accessing enclosing jsp's var in included jsp