首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 ><%@taglib uri=“www.Spring form work.org/tag/form”prefix=“表单”%> <path=:path=“student1 1.*”/>导致“无法编译JSP页面”错误

<%@taglib uri=“www.Spring form work.org/tag/form”prefix=“表单”%> <path=:path=“student1 1.*”/>导致“无法编译JSP页面”错误
EN

Stack Overflow用户
提问于 2015-12-02 06:33:05
回答 1查看 1.2K关注 0票数 0

我正在尝试学习Spring,当从互联网上试用一个示例时,我得到了以下错误:

代码语言:javascript
复制
HTTP Status 500 - Unable to compile class for JSP

type Exception report

message Unable to compile class for JSP

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

exception

org.apache.jasper.JasperException: Unable to compile class for JSP
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:600)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

java.lang.NullPointerException
    org.apache.tomcat.util.descriptor.tld.TldResourcePath.hashCode(TldResourcePath.java:164)
    java.util.HashMap.hash(HashMap.java:338)
    java.util.HashMap.get(HashMap.java:556)

这是我的JSP页面:

代码语言:javascript
复制
<%@taglib uri="www.springframework.org/tags/form" prefix="form" %>
<html>
<head>
<title>Admission Form</title>
</head>
<body>

<h1>${header_msg}</h1>
<h3>Admission Form for Engineering Courses</h3>

<form:errors path="student1.*" />
<form action="/Admissions/submitAdmissionForm.html" method="post">
    <table>
    <tr><td> Student's Name :   </td><td>   <input type="text" name="studentName" />    </td></tr>
    <tr><td> Student's Hobby :  </td><td>   <input type="text" name="studentHobby" />   </td></tr>
    <tr><td> Date of Birth :    </td><td>   <input type="text" name="studentDOB" />     </td></tr>
    <tr><td> Mobile No :        </td><td>   <input type="text" name="studentMobile" />  </td></tr>

    <tr><td> Skill set :        </td><td>   <select name="studentSkills" multiple>
                                            <option value="Core Java">Core Java</option>
                                            <option value="Spring Core">Spring Core</option>
                                            <option value="Spring MVC">Spring MVC</option>
                                            </select> </td></tr>
    </table>

    <table>
    <tr><td> Address :  </td></tr>
    <tr><td> Country:   <input type="text" name="studentAddress.country" />     </td>
        <td> City:      <input type="text" name="studentAddress.city" />        </td>
        <td> Street:    <input type="text" name="studentAddress.street" />      </td>
        <td> Pin code:  <input type="text" name="studentAddress.pincode" />     </td></tr>

    <tr><td> </td><td>  <input type="submit" value="Submit this form" />        </td></tr>
    </table>
</form>

</body>
</html>

我的控制器类包含以下代码:

代码语言:javascript
复制
@ModelAttribute
public void addingCommonObjects(ModelAndView model) {

    model.addObject("header_msg", "College of Engineering, Adoor");
}

@RequestMapping(value="/submitAdmissionForm.html", method=RequestMethod.POST)
public ModelAndView submitAdmissionForm(@ModelAttribute("student1") Student student, BindingResult result) {

    if(result.hasErrors()) {
        ModelAndView model = new ModelAndView("AdmissionForm");
        return model;
    }
    ModelAndView model = new ModelAndView("AdmissionFormSuccess");
    return model;
}

在控制器中添加BindingResult,在JSP页面中添加<form:errors>之前,一切正常。当你们看的时候,这可能是代码中的一个小问题,但在过去的3-4天里,我一直试图找出这个问题。请建议一下。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-02 08:00:41

代码语言:javascript
复制
<%@taglib uri="www.springframework.org/tags/form" prefix="form" %>

uri在上面的行中不正确。uri中缺少http。试着在下面

代码语言:javascript
复制
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34036324

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档