Error in request.getRequestDispatcher()

C

cold80

I'm developing my first web application with Java technololgies. I have
a FrontController class (a Serverlet) that accept every request from
the browser. After checking the URI requested is right I use the method
request.getRequestDispatcher in this way

request.getRequestDispatcher(page).forward(request, response);

where page is the new URI I want to forward to, for example

/WEB-INF/pages/index.jsp

When I reach this particular line I get the error

javax.servlet.ServletException:
org/apache/jsp/WEB_002dINF/pages/index_jsp (wrong name:
org/apache/jsp/WEB_002dINF/pages/Index_jsp)

It seems that it can't find the page index.jsp in the path specified,
but I'm sure there is! I'm using NetBeans 4.1 to develop the
application, and the file index.jsp is actually a blank jsp file. I
have some samples with the same structure and they all work, but I
can't find what's the difference with mine.

I need help

Thanks a lot

Cold
 
A

Andrea Desole

cold80 said:
I'm developing my first web application with Java technololgies. I have
a FrontController class (a Serverlet) that accept every request from
the browser. After checking the URI requested is right I use the method
request.getRequestDispatcher in this way

request.getRequestDispatcher(page).forward(request, response);

where page is the new URI I want to forward to, for example

/WEB-INF/pages/index.jsp

When I reach this particular line I get the error

javax.servlet.ServletException:
org/apache/jsp/WEB_002dINF/pages/index_jsp (wrong name:
org/apache/jsp/WEB_002dINF/pages/Index_jsp)

It seems that it can't find the page index.jsp in the path specified,
but I'm sure there is! I'm using NetBeans 4.1 to develop the
application, and the file index.jsp is actually a blank jsp file. I
have some samples with the same structure and they all work, but I
can't find what's the difference with mine.

two things:
1) names look a bit strange. Please post the code, as simple as
possible, of a complete servlet that reproduces the problem. For
example, do you have the problem with:

public class FrontController extends HttpServlet
{
public void doGet( HttpServletRequest request,
HttpServletResponse response)
{
RequestDispatcher dispatcher = request.getRequestDispatcher(
"/WEB-INF/pages/index.jsp" );
dispatcher.forward( request, response );
}
}

2) I think it should be possible to forward to a page in the WEB-INF
directory (altough I have never tried), but the WEB-INF is a bit special
directory, and usually pages are not supposed to be there. Try to
forwarad to another location
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top