wood burning stoves 2.0*
The moose likes JSP and the fly likes how to make a variable available across tag files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to make a variable available across tag files?" Watch "how to make a variable available across tag files?" New topic
Author

how to make a variable available across tag files?

Shraddha Jain
Greenhorn

Joined: Feb 02, 2006
Posts: 27
i want to use a boolean attribute , which i set in a tag file A inside another tag file B which is nested in A, i tried doing this by jspContext.setAttribute("header",new Boolean("true"), PageContext.PAGE_SCOPE); in tag File A,
then using
jspContext.getAttribute("header",PageContext.PAGE_SCOPE); in tag file B. but this isnt helping at all! any suggestions?
Ola Daniel
Ranch Hand

Joined: Jul 27, 2005
Posts: 105
if you use this page attribute in tag file A
<%@variable name-given="header" variable-class="java.lang.Boolean" scope="AT_BEGIN"%>
then set the attribute like you are doing in Tag file A.

Yu will be able to get it in Tag file B.

By the way if i were you i would avoid the use of scriptlets.


SCJP 1.4, SCWCD 1.4
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler et al, Refactoring: Improving the Design of Existing Code, 1999
Shraddha Jain
Greenhorn

Joined: Feb 02, 2006
Posts: 27
so there is a better way to do this then? would be gr8 if you'd share your idea!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to make a variable available across tag files?
 
Similar Threads
Broad design suggestions requested
Reading environment entry from a custom tag ..
Attributes in Tag Files: 'Tag' scope or Page scope?
Custom Tag & standard action doubt?
Associating button with text field