Solved

Redirecting response, request from POST to GET within JSP

Posted on 2004-08-08
5
260 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
  • 3
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
sompol_kiatkamolchai earned 300 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Ransomware continues to grow in reach and sophistication, putting data everywhere at risk. Learn how to avoid being caught in its sinister clutches with these 11 key tips.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

821 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