Java 无法从控制器重定向到JSP

Java 无法从控制器重定向到JSP,java,jsp,spring-mvc,Java,Jsp,Spring Mvc,我正在检查登录凭据,如果不匹配,我会将其发送回index.jsp。但它无法找到index.jsp,因为index.jsp不在剩余jsp所在的文件夹Web INF/views中。我的index.jsp在Webapp中 在LoginController中,我有一个方法loginFailure(),我想从这个方法重定向到index.jsp。我怎样才能寄出去 登录控制器 package com.cts.Controller; import javax.servlet.http.HttpServletR

我正在检查登录凭据,如果不匹配,我会将其发送回index.jsp。但它无法找到index.jsp,因为index.jsp不在剩余jsp所在的文件夹
Web INF/views
中。我的index.jsp在Webapp中

在LoginController中,我有一个方法
loginFailure()
,我想从这个方法重定向到index.jsp。我怎样才能寄出去

登录控制器

package com.cts.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.cts.Services.LoginService;
import com.cts.entity.LoginDetails;
import com.cts.entity.to.LoginTo;

@Controller
public class LoginController {

    @Autowired
    LoginService loginService;

    @RequestMapping(value = "/login", method = RequestMethod.GET)
        public ModelAndView login() {
        ModelAndView model = new ModelAndView("login");

        System.out.println("M in controller");
        return model;

    }

    @RequestMapping(value = "/LoginCheck", method = RequestMethod.GET)
        public ModelAndView loginSuccess(@ModelAttribute LoginTo loginto) 
    {
        System.out.println("hiiiiiiiii Value of login id is:"+loginto.getUserid());
        System.out.println("My password is:"+loginto.getPassword());
        boolean result=loginService.loginCheck(loginto);
        if(result==true)
        {
        ModelAndView model = new ModelAndView("loginSuccess");
        System.out.println("M in Login Success controller");
        return model;
        }
        else
        {
            ModelAndView model = new ModelAndView("loginfailure");
            System.out.println("M in Login Failure");
            return model;
        }
    }

    **@RequestMapping(value = "/return", method = RequestMethod.GET)
        public String loginFailure() 
    {
        System.out.println("M in Login Failure controller");
        return("index");
    }**

    }
Dispatcher-Servlet.XML


com.cts.entity.LoginDetails
com.cts.entity.RegistrationDetails
org.hibernate.dialogue.mysqldialogue
使现代化
符合事实的
LoginFailure.jsp


在此处插入标题
登录失败

您可以使用具有分辨率顺序的多视图解析器策略。例如,您可以首先使用XmlViewResolver来解析视图是否匹配,如果不匹配,则可以转到internalviewresolver。最好的指南是