• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Forward or sendredirect

 
Durga Krishna
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,

I have a shopping cart application. where the user can select the items form the list, which he wants to buy.After selecting, he can click on "Buy" button. Then the user should see the payment gateway page where he can pay the amount using his credit card. Once the payment is done, the message has to be shown in my shopping cart application -"Payment done successfully".

Please tell me whether I have to use forward or send redirect here. And why?


 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read a very intresting article about your question.
I am sure you will find all the answers you need there

Scriptless JSP Pages: The Front Man by Bear Bibeault

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really see how that's related.

Forward or redirect to where? The gateway, or the "success" page? Do you control the gateway?
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How that article is related to redirect and forward and why?
Probably my english is very bad but i am sure i found there a really similar issue, and a solution to it, read it if you like.
If i got it wrong, well...sorry, but read that article anyway.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have, several years ago. Good article. Just not related.
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And in my opinion it keeps being related with the issue of the post.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below link might be help you
http://www.coderanch.com/t/434630/Struts/Post-Request-technique
 
Alpesh Padra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone provide technical detail about why do we use forward and whay do we use redirect ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps this article might help.
 
Prabhat Shankar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Perhaps this article might help.


Hi,

Basically main difference between forward and sendredirect is that when we want to call any JSP or Servlet which is not in my web application then we should go for sendredirect. sendredirect initiate a new request for different JSP or Servlet.


forward is used when we want to call any JSP or Servlet which is present in my web application here same request is sent to different JSP & Servlet.
 
Durga Krishna
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I din't get proper answer from the given articles. Thanks every body.

The payment gateway is another application, not available in my server.

If I use send redirect, it will be new request object.
Then what about the values (selected items id in the page) in the request object in the current request?

And how can I show success message in the current page?

 
Alpesh Padra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed, it really helps me.

Thanks.
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Durga,
the values in the request object are lost with sendRedirect, because you create a new request.

You could use session attributes instead.
 
Prabhat Shankar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Durga Krishna wrote:I din't get proper answer from the given articles. Thanks every body.

The payment gateway is another application, not available in my server.

If I use send redirect, it will be new request object.
Then what about the values (selected items id in the page) in the request object in the current request?

And how can I show success message in the current page?



I think payment gate way third party would have provided you to pass some credential in url parameters.

Ex:
www.java.com?user=prabhat&accNo=452556555
 
Durga Krishna
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any other answer please...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What else are you looking for?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic