Struts标签库1.2显示了Jasper异常

时间:2015-08-26 06:54:19

标签: struts struts-1

我想使用Struts标记库构建表单。

web.xml文件

<?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5">
        <session-config>
           <session-timeout>
           30
           </session-timeout>
        </session-config>
        <welcome-file-list>
             <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    </web-app>

index.jsp文件

<%@taglib prefix="html" uri="http://struts.apache.org/tags-html"%>
<!DOCTYPE html>
<html:html>
    <html:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <html:title>JSP Page using Struts html tags</html:title>
    </html:head>   
    <html:body>
        <h1>Hello </h1>
    </html:body>
</html:html>

输出页面显示

HTTP Status 500 -    
type Exception report    

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /index.jsp(4,4) No tag "head" defined in tag library imported with prefix "html"
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)
    org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1182)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1415)
    org.apache.jasper.compiler.Parser.parseBody(Parser.java:1623)
    org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:973)
    org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1241)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1415)
    org.apache.jasper.compiler.Parser.parse(Parser.java:130)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.24 logs.

1 个答案:

答案 0 :(得分:2)

没有<html:head>标记。

或多或少像错误状态。

接下来你会发现没有<html:body>标签。