This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Custom tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Custom tags" Watch "Custom tags" New topic
Author

Custom tags

Jean Miles
Ranch Hand

Joined: Aug 20, 2003
Posts: 53
I can I access variables in scriptlets in JSP?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

This question is so vague as to be meaningless. And what does it have to so with custom tags?
But, using one possible interpretation of the question, yes you can create and reference local variables in Java scriptlets within a JSP. Any such scriplets become part the service method of the JSP-generated servlet.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jean Miles
Ranch Hand

Joined: Aug 20, 2003
Posts: 53
Actually the question is based on the topic 'Custom tags' can i reference variables that are defined in scriplets in Custom tags?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

More carefully-worded questions will get better answers.
To this one: no. While you can pass the values of scripting variables to custom tags through the attributes that allow run-time values, you cannot access scripting variables by name in custom tags.
Tacking values onto the page context as attributes is a common means of passing non-attribute info to tags. (Though I'd be cautious about doing so since you can create artificial bindings between your pages and tags that could limit the reusability of the tags).
bear
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Custom tags
 
Similar Threads
Cant use object from another class
WA #1.....word association
Posting to bump up my count...
Text box value is not being completely filled with request attribute
The x900 effect ?