The Show tag name of the request object
CHAPTER 8 Using JavaBeans with tags sample JSP file presents different usage patterns for the tag. Sometimes it is employed in an elementary way. For example, we only specify the JSP attribute name associated with the object (optionally the scope) and the name of the property. There might be a case, however, in which the tag is used with runtime expressions and indexed properties; in fact, we produce a fine table with the header names and values by using the tag with the header indexed property. This section showed how easy it is to print the values of JavaBeans properties back to the response flowing to the user. Now we move on to build the second tag of our library, which allows us to export new JavaBeans from our tags and have them serve as scripting variables in the page. 8.4 Exporting bean values from tags Exporting new scripting variables from a tag is a handy feature. For example, a JDBC connection tag can connect to a database and export a JDBC connection as a scripting variable so that JSP scriptlets further down the page may use the connection object. Though useful, exporting a new scripting variable is more than a minor maneuver for the JSP engine; it first needs to know: The Java type of the new scripting variable so that a correct Java scripting variable will be declared for the newly exported object. The duration (scope) of the scripting variable. Sometimes you want your Java scripting variable to last until the end of the page; in other cases you may want it to exist within the body of the tag. The JSP environment needs to be informed of that. The name of the scripting variable. This reflective information must arrive at the JSP environment in order to take advantage of it while translating the JSP file to a servlet. The methods to provide this information were defined in the JSP specification, which we will present now. Next, we take a look at a tag whose job it is to export JavaBean property values as new JSP scripting variables. 8.4.1 Informing the runtime of exported scripting variables The JSP specifications define a simple way to inform the JSP runtime of the exported scripting variables, by overriding yet another method in TagExtraInfo. Up until now, the only method we overrode in TagExtraInfo was isValid(), which we used to validate tag attribute syntax and values. The TagExtraInfo class also allows you to indicate any scripting variables your tag will export by overriding getVariableInfo().
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services