Did not find handler method for [/index.jsp]。。。。

新手,我只是页面访问http://localhost:8080/ce2/eq/userAction/loginInit.do 能到action就是 renturn “index”提示找不到 页面404
preHandle方法名:loginInit
11:15:52.754 [http-bio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - Rendering view [org.springframework.web.servlet.view.InternalResourceView: name 'index'; URL [/eq/index.jsp]] in DispatcherServlet with name 'ce'
11:15:52.755 [http-bio-8080-exec-3] DEBUG o.s.w.s.view.InternalResourceView - Added model object 'locale' of type [java.lang.String] to request in view with name 'index'
11:15:52.756 [http-bio-8080-exec-3] DEBUG o.s.w.s.view.InternalResourceView - Forwarding to resource [/eq/index.jsp] in InternalResourceView 'index'
11:15:52.762 [http-bio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'ce' processing GET request for [/ce2/eq/index.jsp]
11:15:52.762 [http-bio-8080-exec-3] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Looking up handler method for path /index.jsp
11:15:52.762 [http-bio-8080-exec-3] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Did not find handler method for [/index.jsp]
11:15:52.762 [http-bio-8080-exec-3] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/ce2/eq/index.jsp] in DispatcherServlet with name 'ce'
11:15:52.762 [http-bio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
afterCompletion方法名:loginInit
11:15:52.763 [http-bio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
11:15:52.763 [http-bio-8080-exec-3] DEBUG o.s.o.h.s.OpenSessionInViewFilter - Closing single Hibernate Session in OpenSessionInViewFilter
11:15:52.763 [http-bio-8080-exec-3] DEBUG o.s.o.hibernate3.SessionFactoryUtils - Closing Hibernate Session

web.xml
<?xml version="1.0" encoding="UTF-8"?>


contextConfigLocation

classpath:conf/spring.xml


<!--
webAppRootKey
ce2
-->

encoding
org.springframework.web.filter.CharacterEncodingFilter

encoding
UTF-8


forceEncoding
true



osivFilter
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter


encoding
.do


osivFilter
.do


encoding
.jsp


osivFilter
.jsp


encoding
.action


org.springframework.web.context.ContextLoaderListener


org.springframework.web.util.IntrospectorCleanupListener


ce
org.springframework.web.servlet.DispatcherServlet

contextConfigLocation
classpath:conf/spring/ce-servlet.xml

1


ce
/eq/


30


index.jsp

spring.xml
<?xml version="1.0" encoding="UTF-8"?>
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="true">
location='WEB-INF/setup.properties' />










































classpath*:conf/hbm/*.hbm.xml




true
true
true

com.ce.util.SqlServer2008Dialect

false
false
org.hibernate.cache.EhCacheProvider
false
true
20





classpath:conf/spring/ehcache-application.xml


/WEB-INF/cache/application










UserAction
package com.ce.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.ce.biz.UserBiz;
import com.ce.entity.User;
import com.ce.web.ParentsControl;

/**

  • 用户action
    */
    @Controller
    public class UserAction extends ParentsControl{
    private static final Logger log = LoggerFactory.getLogger(UserAction.class);

    private User user;
    @Autowired
    private UserBiz userBiz;
    @RequestMapping(value={"userAction/loginInit.do"},method={ RequestMethod.GET})
    public String loginInit(HttpServletRequest request, HttpServletResponse response){
    // String root=request.getSession().getServletContext().getRealPath("/");
    // request.setAttribute("ctx", root);
    return "index";
    }

}图片说明

3个回答

ce-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="true">




/WEB-INF/i18n/app/messages
/WEB-INF/i18n/frame/messages
























/loginInit.do
/register.do
/login.do
/logout.do











/error/requiredParameter
/error/mismatchParameter
/error/bindException
/error/integrityViolation









context:annotation-config/

需要配置jsp文件存储位置,否则到默认位置找,具体网上查

mengqingyu555
暮云收尽溢清寒 <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/jsp/" p:suffix=".jsp" />,这个配置了吗?p:prefix="/jsp/"就是配置jsp在webroot下的目录
大约 4 年之前 回复
lcrmeiniuer
仩上 我配置了webroot下面的eq文件下,直接访问aciton可以,直接访问jsp就不行,还有就是action返回字符串提示就找不到
大约 4 年之前 回复

springmvc  构造restful时一直报 "Did not find handler method for ......"   后来发现是同事配置shiro时又将spring配置文件加载了一遍导致的。修复后恢复正常。......
答案就在这里:springmvc restful Did not find handler method for
----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?

zkfvip_001
Always_Do_The_Best 垃圾
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问