tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From david delbecq <delbd+jaka...@oma.be>
Subject Re: Wrong path to servlets
Date Tue, 29 Jan 2008 22:01:23 GMT
According to sun's doc: "The pathname must begin with a "/" and is 
interpreted as relative to the current context root."
is /servlet actually in the same webapplication as your jsp? Or did you 
put your jsp inside ROOT and your servlets inside a separate "servlet" 
webapp?
In later case, you should use 
getContext("servlet").getRequestDispatcher("org.......").forward(...);


Emmanuel Milou a écrit :
> The jsp code is very basic. Here is the content of each jsp file:
> <%
> getServletContext().getRequestDispatcher("/servlet/org.capella.intranet.agenda.AgendaServlet").forward(request,response);

>
> %>
>
> Of course, each jsp file calls the right servlet... like I said 
> before, if the jsp file is in a sub directory, the name of the sub 
> directory is preprended to the path .
>
>
> david delbecq wrote:
>> Difficult to say, without the actual jsp code....
>>
>> Emmanuel Milou a écrit :
>>> Hi,
>>> I would like to have your input on this problem. It is quite tricky 
>>> and I hope you will be able to help me.
>>> Here is my configuration: JDK 1.6.0_03, Apache-Tomcat5.5.25, 
>>> connector ajp13.
>>> When I click on an option in the menu bar of my home page, JSP code 
>>> is executed to call the servlet. It looks like that:  
>>> /getServletContext().getRequestDispatcher("/servlet/path_to_servlet").forward(request,response);

>>>
>>> /The problem is that before the page is displayed, the path is 
>>> modified, and if the JSP file was in a subdirectory (for instance 
>>> named toto), the name of the directory is added to the path, and 
>>> finally the browser looks for /toto/servlet/path_to_servlet, /which 
>>> doesn't exist and I get an 404 Not Found Error. The right URL is 
>>> /servlet/path_to_servlet, it works when I manually test.
>>> It gives the same result for each JSP file saved in a subdirectory.
>>> You must know that I used to run Tomcat 5.5 with the same 
>>> configuration and it worked fine.
>>> Thanks for your help.
>>>
>>> Emmanuel
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message