| < Day Day Up > |
|
The focus of the Logic tag library is on decision making and object evaluation. This taglib contains 14 tags that can be used in a Struts application. In this chapter, we introduce you to each of these tags and show you how to use them.
To use the Logic tag library in a Web application, you must complete the following steps. Be sure to replace the value webappname with the name of the Web application that will be using this library:
Copy the TLD packaged with this tag library, struts-logic.tld, to the <CATALINA_HOME>/webapps/webappname/WEB-INF/ directory.
Make sure that the struts.jar file is in the <CATALINA_HOME>/webapps/webappname/WEB-INF/lib directory.
Add the following <taglib> subelement to the web.xml file of the Web application:
<taglib> <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri> <taglib-location>/WEB-INF/struts-logic.tld</ taglib-location> </taglib>
You must add the following taglib directive to each JSP that will leverage the Logic tag library:
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
This directive identifies the URI defined in the previously listed <taglib> element and states that all Logic tags should be prefixed with the string logic.
| < Day Day Up > |
|