Take the 2-minute tour ×

I have login.jsp , forgotpass.jsp files in webapps directory, I have 2 more jsp file under WEB-INF/jsp folder.

Now when the user clicks ForgotPassword link on login.jsp page he is redirected to forgotpassword.jsp when the user enters some data, which is read by one of Spring Controller, the spring controller sets an attribute and returns same jsp page.

My remote-servlet.xml file is having the following configuration.



@RequestMapping(value = "/pass", method =RequestMethod.POST)
    public String recoverPassword(@RequestParam String email, ModelMap model){
        List<String> emails = usersDao.getEmails();
        if (!emails.contains(email)) {        
            model.addAttribute("failMessage", "Password Recovery Failed ! Invalid loginId or EmailId");
            String validEmail = email;
            model.addAttribute("successMessage", "A New Password is Sent to your emailId "+ "xxx"+email.substring(email.indexOf('@')-3,email.length()));
        return "forgotpassword";

The Problem is After prefixing and suffixing the configuration properties the return Path will be /myapp-Path/WEB-INF/jsp/forgotpassword.jsp.

But my forgotpassword.jsp is under /webapps/ directory, but Spring is checking it under WEB-INF/jsp/ folder.

Can we add another property with prefix "/" and suffix ".jsp" ? If this is not possible, please suggest me any solution.

share|improve this question
You can move your jsp to /myapp-Path/WEB-INF/jsp/ that's the easiest way. –  Juliano Mar 7 '13 at 17:05
Yes, But is there a way to define 2 paths ? –  funnyfox Mar 7 '13 at 18:25
No, there isn't. The documentation of method setPrefix (bit.ly/10cJ4Fi) says: "Set the prefix that gets prepended to view names when building a URL". That's the only way to do that, so you can have just one prefix. –  Juliano Mar 7 '13 at 18:36
add comment

1 Answer

If you are so intent of not having the forgotPass.jsp in the same folder, you could always return a ModelAndView, setting the View to a JstlView, or rolling your own for that matter. I have to agree with @funnyfox, however, that it seems silly that you have some requirement that prevents these JSP files from living in the same directory tree.

share|improve this answer
add comment

Your Answer


