• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom tags

 
Jean Miles
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can I access variables in scriptlets in JSP?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jean Miles
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic