0
votes

Actually I have been working on a Spring MVC lately. I am experiencing odd behavior with the project. this is in my dispatcher servlet <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> </bean>

this is my controller

@RequestMapping(value="/login",method=RequestMethod.POST)
public ModelAndView loginThroughCredentials(@ModelAttribute("EmployeeBean") EmployeeBean bean,HttpServletRequest request){
    System.out.println("in login");
    bean=services.getEmployeeFromLogin(bean);
    if(bean!=null){
        System.out.println("true");
        request.getSession(false).setAttribute("employee", bean);
        return new ModelAndView("homePage");
    }
    return new ModelAndView("../index","error", "Username/Password Not Valid");
}

The Issue is , RequestMapping is catching the request with login url pattern. And executes the method.Method executes properly but I get 404 saying

HTTP Status 404 - /EmployeeManagementSystem/WEB-INF/jsp/login.jsp

type Status report

message /EmployeeManagementSystem/WEB-INF/jsp/login.jsp

description The requested resource is not available.

As you can see I have given homePage or index as a view. but they are never invoked the controller redirects the application to login.jsp view which is not present in my application.

Can you please tell me why this is happening??

1

1 Answers

0
votes

I think you can provide little more information, for example what does it print "in login" or "true". Do you have any Spring Security filter in your application? Are you sure you are using POST in the request?