?
Solved

context path mapping problem in servlet

Posted on 2004-11-02
4
Medium Priority
?
209 Views
Last Modified: 2013-11-24
Hi all,
I met a context path problem when I migrate a web application from Tomcat4 to WLS8.1.

1.Code in Jsp (control is a servlet):
...
response.sendRedirect("control?view=jsp/main.jsp");
...

2.files structure:
MyWeb--
           --jsp
           -----forms
           --------login.jsp
           ------preLogin.jsp
           ------main.jsp

3.logs in WLS8.1:
"GET /MyWeb/control?view=jsp/preLogin.jsp HTTP/1.1" 200 1115
"GET /MyWeb/control?view=jsp/forms/login.jsp HTTP/1.1" 200 5472
"POST /MyWeb/control?view=jsp/forms/login.jsp HTTP/1.1" 302 0
"GET /MyWeb/jsp/forms/control?view=jsp/main.jsp HTTP/1.1" 404 4648

The last line "/MyWeb/jsp/forms/" should have been "/MyWeb/".

Thanks,
0
Comment
Question by:li6183
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
petmagdy earned 150 total points
ID: 12476397
please try this:

response.sendRedirect("../../control?view=jsp/main.jsp");
0
 
LVL 8

Expert Comment

by:kiranhk
ID: 12476445
or try this:

response.sendRedirect("/MyWeb/control?view=jsp/main.jsp");

or better still use RequestDispatcher

RequestDispatcher disp = request.getRequestDispatcher("/../../control?view=jsp/main.jsp");
     disp.include( request, response );


http://www.ideas2work.com/jsp-request-dispatcher.html
0
 
LVL 8

Expert Comment

by:kiranhk
ID: 12476500
0
 

Author Comment

by:li6183
ID: 12483318
Thanks, everyone. I use

response.sendRedirect("control?view=jsp/main.jsp");

it can work at the tomcat4. but move to WLS8.1, it doesn't work.does anyone know the reason?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
A solution for Fortify Path Manipulation.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question