0

I am trying to use redirect tag for directing index page to the home page residing in my web project's JSP folder. The hierarchy of my project is as under:

WEB-INF
     jsp
        home.jsp
index.jsp

I am using both the libraries jstl 1.2 and standard.jar Following is the code of my index.jsp

<%@ taglib prefix="core" uri="/tags/c" %>

<core:redirect url="/home"></core:redirect>

When i run the project i recieve the following error;

HTTP Status 404 - /JSTL/home
type Status report
message /JSTL/home
description The requested resource (/JSTL/home) is not available.
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Femme Fatale
  • 870
  • 7
  • 27
  • 56

2 Answers2

1

Files in /WEB-INF are not public accessible (it's not available when you enter their address in browser address bar). The <jsp:include> and any servlets using RequestDispatcher are the only which can access them.

So if you have a controller servlet which is mapped on /* and dispatches the request as follows

request.getRequestDispatcher("/WEB-INF/jsp" + request.getPathInfo() + ".jsp").forward(request, response);

then your <c:redirect> will work. But if you don't have such a controller, then you should use <jsp:include> or move the home.jsp into public webcontent (there where your index.jsp also is) and redirect to home.jsp instead.


Unrelated to the problem, the way you declared the JSTL taglib doesn't give me a strong feeling you're doing things the right way or reading the proper tutorials. I suggest you to take a look in our JSTL tag wiki.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
0

You need to redirect to "/home.jsp", not just "/home".

Eric Giguere
  • 3,495
  • 15
  • 11