wood burning stoves 2.0*
The moose likes Servlets and the fly likes reading returned datas from the url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "reading returned datas from the url" Watch "reading returned datas from the url" New topic
Author

reading returned datas from the url

preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Hi,

I am posting some values to a url and i am getting the return values also.Now i need to read the returned values from the browser.Is it possible? how can i do this? I am getting the following values in the return url:


intTime=1289543555&fltOriginalAmount=10.00&strOriginalCurrency=GBP&intTransID=565551


I want to read these valued from the browser and have to upload it in the database. Please assist me to read this.

Thanks
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3068
    
  33

I believe that you are using the Servlets. In that case you can access it from the request object (HttpServletRequest) by using the getParameter("name of the parameter") method.


Mohamed Sanaulla | My Blog
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38087
    
  22
mohamed sanaullah wrote:I believe that you are using the Servlets. . .
In that case this thread should be moved to the Servlets forum.
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Thanks mohamed, I am using spring framework and when i tried to get the datas from the url using request.getParameter , i am getting the values of the datas whatever i have posted and not the datas what is returned in the url.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3068
    
  33

preethi Ayyappan wrote:Thanks mohamed, I am using spring framework and when i tried to get the datas from the url using request.getParameter , i am getting the values of the datas whatever i have posted and not the datas what is returned in the url.


You can try using: getQueryString() method of request object. Though I dont know how it is in Spring framework.
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
I have tried that. But i am getting null
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
I have tried to get the query string using request.getQueryString(). But i am getting the query string of whatever i have posted .I am not getting the response query string.please help me to do this.

I am posting the code i have tried.

Payment.jsp:


The controller is:


The output is :


inttestintTestMode=1&intInstID=254653&strCartID=654321&strDesc=description+of+goods&fltAmount=10.00&strCurrency=GBP&strCardHolder=Joe+Bloggs&strPostcode=BA12BU&strEmail=pritha%40peopletech.co.in&strCardNumber=1234123412341234&intCV2=707&strExpiryDate=0612&strCardType=VISA&strCountry=GB&fltAPIVersion=1.3&strTransType=PAYMENT,http://localhost:8080/ICash/jsp/Readdata.do

Am i wrong anywhere?Please assist me


Thanks
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3068
    
  33

If you are looking for the data in the response- Should you not be using Response object?
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 507

Hi Preethi,
Can you please clearly explain us what you are trying to do, because onload of the jsp itself, you are submitting the form..


Regards, Prasad
SCJP 5 (93%)
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
It seems to me that what you try to do is to send the form first to some third party site and after that read what you get as a reply? But you can not do that with normal javascript code that just sends forms the nromal way. You actually send nothing of the data that was sent to the third party site to your own server!

Your html form first sends the form to a third party site AND then resends it to your own server. It is "illegal" to do anything with javascript after you have sent the form the first time. And in any case you are NOT going to get anything from the third party site written back to your form before you resend (which is itself illegal as I said) it to your own server.

There are several possibilities to accomplish what you are trying to do. One is to first send your form using AJAX to the third party site and then read the resposnse back to your form and after that do the actual sending of the form to your own server. And other possibility would be to just send the form to your server and then let the server resend the values to the third party server and then read the response back at your own server. The last one of these is a more secure way since if you just trust that the client side is not going to modify the results (between the ajax send and the actuals send to your server) then you may get in to a big problem in the future.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reading returned datas from the url
 
Similar Threads
Ajax to show a table with Display tag
Ajax and struts integration
ejbSelect...() method
writing delimiters with csv files
using byte array to copy contents of one file to another