?
Solved

Redirecting response, request from POST to GET within JSP

Posted on 2004-08-08
5
Medium Priority
?
263 Views
Last Modified: 2010-04-01
Hi,

I have a JSP A which is listening for a request then it forwards it to servelt A (I just have <jsp:include></jsp> tag). Then servelt A process the request and parameters then displays the result back to JSP A. Now the way I have written my servlet A I am using doGet method to process all the parameters. I am using doPost for some other routines.
The third party App will post their results to my JSP A with the POST method. How can I get all the prameters and then redirect them to my servlet's A doGet method?

Please provide some concreate examples! Thank you in advance!

Gene.
0
Comment
Question by:brige03
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
sompol_kiatkamolchai earned 1200 total points
ID: 11750176
The one simple solution is in the included jsp you add this code at the top of it.

request.setAttribute("doGet", "YES");

and in the doPost method of servlet file.

if(((String)request.getAttribute("doGet")).equalsIgnoreCase("YES")) {
  doGet(request, response);
}
0
 

Author Comment

by:brige03
ID: 11754031
This is exactly I was looking for! Thank you!
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11754074
:)
0
 

Author Comment

by:brige03
ID: 11897383
THE OBOVE WORKED JUST FINE!

However, I have an additional condition:

1) JSP page sends a POST request to my Servlet E

2) Servlet E listens for a specific parameter (see above thread) then it redirects it to its doGet method

3) doGet proccess the information and then at some point redirects the request to another Servlet C

Question:

Servlet C gets the request from servlet E just fine but it's doPost get's the response! I need to route it to doGet right away from servlet E. How can I do that?

Thanks.

Gene.
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11929024
Could you dump your code in part of redirect to servlet C?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this article, WatchGuard's Director of Security Strategy and Research Teri Radichel, takes a look at insider threats, the risk they can pose to your organization, and the best ways to defend against them.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

719 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