What lines starting with <%@ should be added at the beginning of a JSP file to be able to make use of the tag.
I have added the following line to the beginning of my jsp.
<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>
But Eclipse IDE says
T开发者_如何学运维he tag handler class for "html:link" (org.apache.struts.taglib.html.LinkTag) was not found on the Java Build Path
next to the < html:link > tag.
What is wrong here?
What I am trying to do is - load page1.jsp from homepage.jsp through struts actionmapping.
If you have download the full struts jar, you don't need to declare your taglibs in web.xml
.
- Download Struts from here. In my case, I've downloaded the struts-1.3.10-all.zip
- Copy all the jars from the
<zipped file>\struts-1.3.10\lib
into yourWEB-INF\lib
folder (in your project). - At the top of each JSP page that will use JSP tags, add line(s) declaring the JSP tag libraries used on this particular page, like this:
Example:
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
More on the Struts 1.x installation Guide.
You have to declare it at your web.xml
deployment descriptor:
<taglib>
<taglib-uri>http://struts.apache.org/tags-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
And keep a copy of the TLD file at the location specified there.
Also, you have to check that you have included the struts-taglib.jar
on your classpath (the /WEB-INF/lib folder, in this case).
精彩评论