Saturday, January 17, 2009

Using Struts 1.x without tld files

These are the "tag library descriptor" files that describe the custom tags in the various Struts tag libraries. The tld file for any Struts taglibs that you use should be copied into the WEB-INF directory of your web application. (Applications under Servlet 2.3 containers can omit this step if the standard uri is referenced.)

That can be achieved as follows.
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>


For Servlet 2.3/2.4 containers only: The Servlet 2.3 and 2.4 specifications simplify the deployment and configuration of tag libraries. The instructions above will work on older containers as well as 2.3 and 2.4 containers (Struts only requires a servlet 2.2 container); however, if you're using a 2.3/2.4 container such as Tomcat 4.x/5.x, you can take advantage of a simplified deployment.
All that's required to install the Struts tag libraries is to copy struts.jar into your /WEB-INF/lib directory and reference the tags in your code like this:


Note that you must use the full uri defined in the various tlds so that the container knows where to find the tag's class files. You don't have to alter your web.xml file or copy tlds into any application directories.

2 comments:

s said...

what is the problem when we using tld files?


why are you designing the application without tlds if struts frmework provides sme tlds?


Surya
Java Developer(Presently working on Struts)

s said...

what is the problem when we using tld files?


why are you designing the application without tlds if struts frmework provides sme tlds?


Surya
Java Developer(Presently working on Struts)