JSP抛出异常

时间:2016-06-05 16:25:57

标签: java spring hibernate jsp

JSP页面:

μ> #load "nums.cma";;
μ> #use "fact_big_int.ml";;
val factorial : int -> big_int = <fun>
μ> string_of_big_int (factorial 10);;
- : string = "3628800"
μ> string_of_big_int (factorial 30);;
- : string = "265252859812191058636308480000000"

我在JSP Page

上面运行时遇到异常
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Sign-Up/Login Form</title>
<link rel="stylesheet" href="loginandsignup/css/normalize.css">
<link rel="stylesheet" href="loginandsignup/css/style.css">

</head>

<body>

    <div class="form">

        <ul class="tab-group">
            <li class="tab active"><a href="#signup">Sign Up</a></li>
            <li class="tab"><a href="#login">Log In</a></li>
        </ul>

        <div class="tab-content">
            <div id="signup">
                <h1>Sign Up for Free</h1>

                <c:url var="userRegistration" value="saveUser.html"/>
                <form1:form id="registerForm" modelAttribute="user" method="post" action="${userRegistration}">

                    <div class="top-row">
                        <div class="field-wrap">
                            <form1:label path="lastName"> First Name<span
                                    class="req">*</span>
                            </form1:label>
                            <form1:input path="lastName" />
                        </div>

                        <div class="field-wrap">
                            <form1:label path="lastName"> Last Name<span
                                    class="req">*</span>
                            </form1:label>
                            <form1:input path="lastName1" />
                        </div>
                    </div>

                    <div class="field-wrap">
                        <form1:label path="lastName"> Email Address<span
                                class="req">*</span>
                        </form1:label>
                        <form1:input path="lastName2" />
                    </div>

                    <div class="field-wrap">
                        <form1:label path="lastName"> Set A Password<span
                                class="req">*</span>
                        </form1:label>
                        <form1:input path="lastName3" />
                    </div>

                    <button type="submit" class="button button-block">Get
                        Started</button>

                    </form1:form>
            </div>

但是当我运行不同格式的jsp(在JSP下面)时,工作正常..

  

不同的格式意味着在上面的JSP中我使用DIV设计了JSP页面   以及使用html标签设计的JSP页面。

SEVERE: Servlet.service() for servlet [jsp] in context with path [/Spring-hibernate-integration-helloworld] threw exception [java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?] with root cause
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
    at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:84)
    at org.springframework.web.servlet.support.RequestContextUtils.getWebApplicationContext(RequestContextUtils.java:81)
    at org.springframework.web.servlet.support.RequestContext.initContext(RequestContext.java:219)
    at org.springframework.web.servlet.support.JspAwareRequestContext.initContext(JspAwareRequestContext.java:74)
    at org.springframework.web.servlet.support.JspAwareRequestContext.<init>(JspAwareRequestContext.java:48)
    at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:76)
    at org.apache.jsp.index_jsp._jspx_meth_form1_005fform_005f0(index_jsp.java:206)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:126)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)

我不知道为什么我在运行上面的JSP时遇到异常。有人请帮助我。

我在Tomcate,Spring,Hibernate中运行JSP

1 个答案:

答案 0 :(得分:0)

好的有点奇怪..但是你可以查看包含所有标签及其渲染信息的spring.form.tld。可能会帮助你弄清楚出了什么问题。

还要检查生成的servlet中的index.jsp

org.apache.jsp.index_jsp._jspx_meth_form1_005fform_005f0(index_jsp.java:206)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:126)

您可以在tomcat下面的路径

中获取生成的类
{TOMCAT_HOME}/work/Catalina/localhost/{app_name}/org/apache/jsp/