You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Phillip Qin <pq...@shareowner.com> on 2003/04/29 22:23:03 UTC

URLConnection and struts

I am trying to use URLConnection to POST data to a remote site.

Browser: onlinestore/order.jsp Submit button -> waitform.jsp

waiform.jsp: <meta http-equiv="refresh" content="1; url=placeOrder.do">

placeOrderAction:
URL url = new URL("http://localhost/onlinetore/post.do") ;
URLConnection = url.openConnection() ;
get OutputStream;
write data
get InputStream......
return null ;

postAction:
get request parameters, order data......
response.sendRedirect("congratulation.do?status=whatever&time=whenever") ;
return null ;

congratulationAction:
get request parameters, status and time
email user
write log
return forward success -> congratulation.jsp

I was expecting to see the congratulation page. But I only get a blank page.
However, by reading from InputStream, I find the page that was generated by
the congratulationAction.

Am I doing anything wrong with struts Action?