Tags that Define Script Variables

Now that you know the basics of custom tags, you can start developing more functional tags for use in your applications. The first feature you will study is that of creating scripting variables that can be used on the Web page.

A scripting variable can be added to the page context using the setAttribute() method of the instance variable called pageContext that points to the javax.servlet.jsp.PageContext object of the Web page. The setAttribute() method takes the following parameters:

  • The name of the scripting variable. This name is used to refer to the variable on the Web page.

  • The object reference to the variable to be added to the page.

  • The scope of the variable that can be one of the following constants defined ...

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.