views:

1247

answers:

3

I am developing a Struts based web application. I am new to Struts. I want to use struts-html.tld taglib, provided by struts, in my jsp pages.

When I searched on net, I came to know that prior to Struts 1.2.9, we need to locate the .tld files manually.

But now these .tld files are packed in .jar files and we need to just use those jar files as any other jar file in our project.

Q1. So my question is in Which jar file these .tld files are located. I came to know from a Javaranch answer that these .tld files are packed into struts-taglib.jar file. I downloaded the full struts libraries but didn't find that jar file.

A: 

I looked in one of our projects using Struts. I can see this tld file: struts2-core-j4-2.0.11.jar\META-INF\struts-tags.tld

Note you can search through Jar files using Windows search. See here if you're having issues searching.

Marcus
Struts 2 tags are not compatible on Struts 1 tags. Actually Struts 2 is from the `WebWork 2` project. It won't work on Struts 1.
The Elite Gentleman
A: 

Download the Full Distribution of Struts and find the struts-blank.war in the archive. Extract the struts-blank.war and under the WEB-INF folder, copy all the .tld files into your WEB-INF folder.

The Elite Gentleman
+1  A: 

It's not clear which version of Struts you're using but the TLD you are referring to is a Struts 1 TLD.

In Struts 1.3.10, it is bundled in struts-taglib-1.3.10.jar/META-INF/tld/struts-html.tld which is distributed in struts-1.3.10-lib.zip. In Struts 1.2.9, you'll find it in the root of struts-1.2.9-lib.zip.

Just in case, note that Struts 2 uses a completely different tag library than Struts 1 and there is only one taglib instead of several. The corresponding TLD is located in struts2-core-2.1.8.1.jar/META-INF/struts-tags.tld.

Pascal Thivent
I am using `struts 2.1.8.1`. I have dropped `struts2-core-2.1.8.1.jar` in `\WEB-INF\lib` directory. After that I have used `<%@ taglib prefix="html" uri="/struts-tags">` in one of my jsp pages in which I want to use `<html:form>` tags provided by struts. But I got one exception which you could see at question http://stackoverflow.com/questions/2395364/struts-exception-the-struts-dispatcher-cannot-be-found
Yatendra Goel
Check my answer to that question @Yatendra Goel
The Elite Gentleman