我正在尝试在我的 liferay 6.0 portlet 应用程序中使用 JSP 2.0 标记文件。
以下是我遵循的步骤:
我的jsp很简单:
home.jsp
.<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <table> <tr> <td> <tags:tagDemo/> </td> <td><c:out value="Cout Hello"/></td> </tr> </table>
我的标签文件非常简单:
/WEB-INF/tags/tagDemo.tag
hello
/WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web- app_2_4.xsd" version="2.4"> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/classes/log4j.properties</param-value> </context-param> <servlet> <servlet-name>view-servlet</servlet-name> <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>view-servlet</servlet-name> <url-pattern>/WEB-INF/servlet/view</url-pattern> </servlet-mapping> </web-app>
这会引发以下错误:
00:14:42,642 ERROR [render_portlet_jsp:154] org.apache.jasper.JasperException: /WEB-INF/jsp/home.jsp (line: 55, column: 6) No tag "tagDemo" defined in tag library imported with prefix "tags"
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:199)
at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1215)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1450)
at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
谁能告诉我问题出在哪里?