The HTML Tag Library Tags


Using the HTML Tag Library

To use the HTML Tag Library in a Struts application, your application's JSPs must declare their use of the library with a JSP taglib directive:

<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

Notice that the prefix attribute is set to "html". This attribute can be set to whatever you want; however, "html" is the accepted default for the HTML Tag Library. The prefix attribute declares the prefix that each tag must have when it is used in the JSP, as shown here:

<html:form action="/logon">

Because "html" was defined as the prefix, the form tag was used as shown. However, if you chose to use a prefix of "strutshtml", the tag would be used the following way:

<strutshtml:form action="/logon">
Note 

Modern application servers use the uri attribute of the taglib directive to automatically resolve the location of the tag library descriptor file. Older application servers that support only JSP version 1.1 and/or version 1.0 require that tag libraries be registered in the web.xml file so that they can be resolved, as shown here:

<taglib>   <taglib-uri>http://struts.apache.org/tags-html</taglib-uri>   <taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location> </taglib>



Struts. The Complete Reference
Struts: The Complete Reference, 2nd Edition
ISBN: 0072263865
EAN: 2147483647
Year: 2004
Pages: 165
Authors: James Holmes

Similar book on Amazon
Struts 2 in Action
Struts 2 in Action
Murach's Java Servlets and JSP, 2nd Edition
Murach's Java Servlets and JSP, 2nd Edition
Jakarta Struts For Dummies
Jakarta Struts For Dummies
Head First Servlets and JSP: Passing the Sun Certified Web Component Developer Exam
Head First Servlets and JSP: Passing the Sun Certified Web Component Developer Exam

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net