Solved

Redirecting response, request from POST to GET within JSP

Posted on 2004-08-08
5
258 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now