File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes URI cannot be resolved Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "URI cannot be resolved" Watch "URI cannot be resolved" New topic
Author

URI cannot be resolved

Kaiser Lautern
Greenhorn

Joined: May 11, 2005
Posts: 18
Hi, folks,

Can anybody please tell me what is exactly the meaning of this message:

org.apache.jasper.JasperException: /index.jsp(0,0) This absolute uri (http://struts.apache.org/tags-bean) cannot be resolved in either web.xml or the jar files deployed with this application.

The .jsp declares the taglig as follows:

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>

It is the application struts-resum´┐Ż. It originally used the
http://jakarta.apache.org/struts/tags-bean uri. I changed to the new one, but the error persists.

Kaiser
Mallika R Kumar
Ranch Hand

Joined: Jan 21, 2004
Posts: 38
Hello,
In your jsp page, the tag declaration should be
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
Here, "uri" points to "taglib-uri" property in web.xml. In your web.xml, the declaration should be something like this:
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

The declaration in web.xml points to your local copy of the struts-bean.tld, and these tld files are placed in <web-root>/WEB-INF directory.

-Mallika.
Kaiser Lautern
Greenhorn

Joined: May 11, 2005
Posts: 18
Hi Mallika,

Thanks for your answer.



In your jsp page, the tag declaration should be
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>


Well, the URI attribute is just a logical name and as such I can choose anything I want, I suppose, as long as I use the same name in the web.xml, where I'm going to map it to an absolute location. So why not a big URL?



The declaration in web.xml points to your local copy of the struts-bean.tld, and these tld files are placed in <web-root>/WEB-INF directory.


Yes. That's what I thought too, but this example I took from a full fledged struts app called struts-resume, which was supposed to work without much effort. And its web.xml does not include the taglib mapping...

Kaiser
Cesar Olavo
Greenhorn

Joined: Nov 19, 2004
Posts: 17
Hello,

You don't need to map the taglib in the web.xml. From Servlet 2.3 (Tomcat 4.1, for example), JARs in WEB-INF/lib are inspected for .tld files in their META-INF directory. If a .tld file exists, its URI can be used in your JSPs without having to define any taglibs in web.xml. Please check if you have all the needed jars.


Cesar
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: URI cannot be resolved