Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

missing struts*.tld files

 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I cannot find the struts-bean.tld,struts-html.tld in short all the struts-*.tld and struts.jar files in my lib directory of struts installations and my program is struk in between i am trying to place these files at WEB-INF/lib directory but could not do it so can anyone tell me how to do that?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For struts 1.3 and above, the struts taglib tlds are in the struts-taglib-1.3.x.jar file. If you include this jar file in your class path, struts will find them.

Also note that you must use the namespace reference rather than the physical location in the taglib declaration. Example:
http://struts.apache.org/tags-bean
[ March 30, 2008: Message edited by: Merrill Higginson ]
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i installed struts-2.0.11.1 and there is no file named stuts-taglib-*.jar. Also i am using Tomcat and placed my struts-2.0.11.1 in the following location "Tomcat/webapps/MyProjectName/struts-2.0.11.1" correct me where to keep the struts installation folder also help in finding the struts-*.tld's.
 
Gregory Boissinot
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tag library file (*.tld) are located in the META-INF directory and sub-directories of your struts distribution.

In your case, in : struts2-core-2.0.11.1.jar\META-INF\struts-tags.tld.

If you have a servlet/jsp container compatible JSP 1.2+; at container startup, all the library (*.jar) in WEB-INF/lib are scanned and the TLD files are located and loaded.
For each tld file it finds, the container looks for the <uri> element and saves a mapping between the uri and the current location of the tld.

After in your jsp, you have just put the directive for use the library.

In your case :
<%@ taglib uri="/struts-tags" prefix="myStrutsprefix" %>

Regards.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I placed my struts2-core-2.0.11.1.jar file in the Tomcat/webapps/MyProjectName/WEB-INF/lib and also my web.xml file has the taglib as
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/lib/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/lib/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/lib/struts-logic.tld</taglib-location>
</taglib>

and my jsp has the directive as
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>


when i run my application its giving me the following error:
exception

org.apache.jasper.JasperException: File "/WEB-INF/lib/struts-bean.tld" not found

if the tld's are present in the struts-core-2.0.11.1.jar/META-INF/lib how do i include them in my projects WEB-INF/lib directory
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts 2 uses a completely different tag library than Struts 1. There is only one taglib instead of several, the TLD is struts-tags.tld, it's in struts2-core-2.0.11.jar, and you would declare it like this:
. You can't use the old tag libraries at all in Struts 2.

Converting an application from Struts 1 to Struts 2 is not just a matter of replacing jar files. Struts 2 is very different and requires physical modifications to the JSPs, action classes, and configuration files.
[ March 31, 2008: Message edited by: Merrill Higginson ]
 
Sudhansu Maharana
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Merrill Higginson wrote:Struts 2 uses a completely different tag library than Struts 1. There is only one taglib instead of several, the TLD is struts-tags.tld, it's in struts2-core-2.0.11.jar, and you would declare it like this:
. You can't use the old tag libraries at all in Struts 2.

Converting an application from Struts 1 to Struts 2 is not just a matter of replacing jar files. Struts 2 is very different and requires physical modifications to the JSPs, action classes, and configuration files.
[ March 31, 2008: Message edited by: Merrill Higginson ]



hi Merrill Higginson,

Thanks for this suggestion...


But still i am getting error like below

"org.apache.jasper.JasperException: /index.jsp(10,40) File "/struts-tags" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
"

I am using Struts 2,

Is there any additional setup is required for seting the classpath for the .jar file "struts2-core-2.0.11.jar" to access the "struts-tag.tld" file in strtus 2.

Can you guide me?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic