tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <rick.reum...@gmail.com>
Subject Re: Best practice for taglib declaration?
Date Tue, 05 Apr 2005 18:58:01 GMT
John Fereira wrote the following on 4/1/2005 2:28 PM:

> So why not use an include tag"
> 
> <%@ include file="/WEB-INF/jsp/Include.jsp" %>
> 
> where Include.jsp looks something like:
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>    "http://www.w3.org/TR/html4/loose.dtd">
> <%@ page contentType="text/html" %>
> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

A slightly cleaner solution, imo, if using JSP2.0 is to use a fragment. 
In you web.xml right after error declarations and befor session config:

<jsp-config>
     <jsp-property-group>
       <url-pattern>*.jsp</url-pattern>
       <include-prelude>/WEB-INF/jspf/headertags.jspf</include-prelude>
     </jsp-property-group>
   </jsp-config>

and the headertags.jspf would have:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles" %>

//etc


-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message