Announcement Announcement Module
No announcement yet.
Redirect expose jsp path? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Redirect expose jsp path?

    I have put all of my JSP inside WEB-INF directory, so that no one can access the jsp directly. Normally, all of the view should be called by controller.

    Say, I have mapped a request /home.html to HomeController and then it would dispatch to the view name home which is located at /WEB-INF/jsp/home.jsp (by using prefix-suffix mapping as viewResolver)

    The problem is that I want to redirect the request by sending redirect to browser, so I use
    return new ModelAndView(new RedirectView("/home.html"))
    But in the browser's address bar, I see something like:
    And actually I want it to redirect to http://serverName/appName/home.html

    How can I do that?

  • #2
    Originally I use websphere that will have such exposing JSP path problem. I found that if I use Tomcat, the redirect is normal.


    • #3
      It turns out that I'm tracing wrong. So it is not related the to RedirectView object problem.

      The source of the problem is: in WebSphere, if I use request.getRequestURL(), it would not return what the browser has initially request, but the real jsp location.

      So does that mean I have to construct the path from other parameter instead?