• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading returned datas from the url

 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49808
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried that. But i am getting null
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are looking for the data in the response- Should you not be using Response object?
 
Prasad Krishnegowda
Ranch Hand
Posts: 670
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic