Using Custom Tags to Define Scripting Variables

Custom tags may also define scripting variables to use within the JSP page. Scripting variables are used in processing JSP page content, just as variables would be in any Java implementation. The scripting variables can be referenced the same as JavaBeans: by using the getAttribute() and setAttribute() methods. To create a scripting variable, implement a class that extends the TagExtraInfo class as shown in the GreetingsTei.java file in Listing 18.6.

Listing 18.6. GreetingsTei.java
 package com.tags; import javax.servlet.jsp.tagext.*; public class GreetingsTei extends TagExtraInfo { public GreetingsTei() {} public VariableInfo[] getVariableInfo(TagData data) { return new VariableInfo[] { new VariableInfo("bidderId","String",true, ...

Get BEA WebLogic Server™ 8.1 Unleashed 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.