Co-operating Tags

Cooperating tags are those that share information in some way. JSP information can be shared using the following mechanisms:

  • Scripting variables

  • Hierarchical (or nested) tags

Using Shared Scripting Variables

One means of writing cooperating tags is to use scripting variables to pass information between the tags. A tag can create a scripting variable that can be retrieved by a another tag on the current page. Depending on the scope of the scripting variable, it can be passed on to other pages in the same request or to pages in subsequent requests. Variables defined by custom tags have the same scoping rules as other variables defined on the page. Scripting variables are a very flexible means of passing information between tags. ...

Get Sams Teach Yourself J2EE™ in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.