再使用taglib 标签 遇到的错误 以及解决方法

再使用taglib 标签 遇到的错误 以及解决方法

org.apache.jasper.JasperException:File " /tags-html " notfound
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:
94 )
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:
404 )
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:
154 )
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:
202 )
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:
460 )
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:
525 )
org.apache.jasper.compiler.Parser.parseElements(Parser.java:
1625 )
org.apache.jasper.compiler.Parser.parse(Parser.java:
173 )
org.apache.jasper.compiler.ParserController.parse(ParserController.java:
247 )
org.apache.jasper.compiler.ParserController.parse(ParserController.java:
149 )
org.apache.jasper.compiler.ParserController.parse(ParserController.java:
135 )
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:
243 )
org.apache.jasper.compiler.Compiler.compile(Compiler.java:
451 )
org.apache.jasper.compiler.Compiler.compile(Compiler.java:
437 )
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:
555 )
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
291 )
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
301 )
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:
248 )
javax.servlet.http.HttpServlet.service(HttpServlet.java:
856 )


Element:servlet
- mapping
Theservlet
- mappingelementdefinesamappingbetweenaservletandaurlpattern

ContentModel:(servlet
- name,url - pattern)


解决:xml中定义就可以了
定义 taglib 标签
如下:

<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/struts-html</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
</taglib>

完整的如下:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>
<display-name>Struts Blank Application</display-name>

<!-- Standard Action Servlet Configuration (with debugging) -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>


<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>


<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>

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

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

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

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

<taglib>
<taglib-uri>/struts-template</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-template.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/jstl/c</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>

</web-app>

现在对这个WEB.xml文件的使用方法开发方法还不是完全的了解

继续学习中

你可能感兴趣的:(java,apache,Web,servlet,struts)