javax.servlet.ServletException:无法解析名称为' dispatcher'的servlet中带有名称的视图

时间:2016-07-19 13:21:12

标签: spring spring-mvc tiles

javax.servlet.ServletException:无法解析名称为

的视图

我是Spring MVC的新手。我在这里遇到了一个问题。我试图从处理程序函数中获取视图。问题是它返回了一个错误,我已经看过很多次并且已经解决了。但为此,我完全陷入困境。你能帮我吗?

@RequestMapping(value="/editcasetypes.htm", method = RequestMethod.GET)
public ModelAndView loadEditCaseTypePage(@ModelAttribute("addcasetypes") CaseTypesFormBean caseTypesFormBean, ModelMap model, HttpSession session, HttpServletRequest request) throws Exception {

    String editThis="20";
    if(!editThis.equals("") && editThis!=null){
    caseTypesFormBean.setCaseTypeCd(Integer.parseInt(editThis));
    caseTypesBusinessDelegate.editCaseTypeToDB(caseTypesFormBean);
    }
    model.addAttribute(caseTypesFormBean);
    return new ModelAndView("addcasetypes", model);
}

我只是添加了JSP的标题部分:



<body onload="init()">
  <form:form modelAttribute="addcasetypes" id="addcasetypes">
            <div id="wrapper_popup">
                    <c:if test="${success}">
                      <div class="successmsg">${message}</div>
                    </c:if>
                    <c:if test="${errors}">
                      <div class="errormsg">${message}</div>
                    </c:if>

            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="frmtable">
                <tr>
                    <td class="label"><spring:message code="lblCaseType" /><span class="mand">*</span></td>
                      <td><form:input path="caseType" id="caseType" tabindex="1" maxlength="80" onchange="zerValidationName(this.value, this.id);"/></td>
                   </tr>
            </table>
&#13;
&#13;
&#13;

瓦片-DEFS:

&#13;
&#13;
<definition name="editcasetypes" extends="popupLayout">
    <put-attribute name="title"  value="CCTNS"/>
    <put-attribute name="body"   value="/WEB-INF/jsp/addcasetypes.jsp"/>
</definition>
&#13;
&#13;
&#13;

view.prop
addcasetypes.(class)=org.springframework.web.servlet.view.tiles2.TilesView
addcasetypes.url=editcasetypes

其中,我尝试重用addcasetype页面进行编辑。添加功能正常。但是对于编辑,点击链接后,我收到此错误:

INFO: CsrfGuard analyzing request /cctns/editcasetypes.htm

INFO: 2016-07-19 18:47:28,863|INFO |httpSSLWorkerThread-8080-2|org.additionalmaster.spring.ManageCaseTasksController|189|:INSIDE loadEditCaseTypePage()

INFO: 2016-07-19 18:47:28,863|INFO |httpSSLWorkerThread-8080-2|org.cctns.additionalmaster.spring.ManageCaseTasksController|193|:ID TO EDIT >> 20

INFO: 2016-07-19 18:47:28,863|INFO |httpSSLWorkerThread-8080-2|org.additionalmaster.dao.CaseTypesDAOImpl|276|:TO EDIT >> 20

SEVERE: StandardWrapperValve[dispatcher]: PWC1406: Servlet.service() for servlet dispatcher threw exception
javax.servlet.ServletException: Could not resolve view with name 'editcasetypes' in servlet with name 'dispatcher'
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1029)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:333)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.owasp.csrfguard.CsrfGuardFilter.doFilter(CsrfGuardFilter.java:79)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.cctns.cas.state.online.filter.ResponseFilter.doFilter(ResponseFilter.java:74)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at com.sun.identity.agents.filter.AmAgentBaseFilter.allowRequestToContinue(AmAgentBaseFilter.java:130)
    at com.sun.identity.agents.filter.AmAgentBaseFilter.doFilter(AmAgentBaseFilter.java:80)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.cctns.cas.state.online.filter.MultipartFilter.doFilter(MultipartFilter.java:114)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.cctns.cas.state.online.filter.CrossScriptingFilter.doFilter(CrossScriptingFilter.java:26)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.cctns.cas.state.online.filter.AuthFilter.doFilter(AuthFilter.java:166)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
    at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:382)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)
    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

INFO: 2016-07-19 18:47:28,878|DEBUG|httpSSLWorkerThread-8080-2|org.apache.tiles.impl.BasicTilesContainer|615|:Render request recieved for definition 'standardhttperror'

有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:0)

嘿,谢谢你的快速反应。我在下面添加了web.xml部分..

&#13;
&#13;
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/applicationContext.xml 
<!--            /WEB-INF/applicationContext-security.xml-->
        </param-value>
    </context-param>

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/log4j.properties</param-value>
    </context-param>
    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>*.htm</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
            <servlet-name>JavaScriptServlet</servlet-name>
            <url-pattern>/JavaScriptServlet</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>redirect.jsp</welcome-file>
    </welcome-file-list>
    <error-page>     
        <error-code>404</error-code>
        <location>/errors/404.htm</location>
    </error-page>
    </error-page>
</web-app>
&#13;
&#13;
&#13;