• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Response from URL

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

The scenario is :

I am hitting a url like say:

http://201.13.24.23/appname/first.asp?param=1¶m=2

but i would get response in other url say:

http://201.13.24.23/success.asp?par1=&par2=value2

How can i fetch the value of par2 in the other url.
I am using Plain java application

Thanks
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

http://201.13.24.23/success.asp?par1=&par2=value2



Normally you will get this kind of URL in a HTTP GET request. So you have to set the values for the parameteres where you set that link (may be in a <a href="...."...>. etc..

Can you explain little more if this is not what you are looking for?

I am using Plain java application



Should be J2EE?
 
robin singal
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok

I am not using J2EE
Actually i am using the URL,URLConnection like Api ..

I am making a URL object and opening a connection for the 1st url i.e

http://201.13.24.23/appname/first.asp?param1=1¶m2=2

here i know what param1 and param2 values are as i am hitting this url .

Now after hitting this url generates a response which i get in 2nd url i.e

http://201.13.24.23/success.asp?par1=&par2=value2

Now, how can i get the value for par2 ?

Thanks
 
Sheriff
Posts: 22768
130
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have absolutely no idea. Seriously.

The reason is, besides the few lines of text you have given us no details whatsoever. We don't know what's on that site. We don't know what par2 is for. We don't know anything.

So, please Tell The Details.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Now after hitting this url generates a response which i get in 2nd url i.e

http://201.13.24.23/success.asp?par1=&par2=value2



What does "get in 2nd url" mean

Are we talking about parsing the String that represents that URL? If so, standard String methods will lwt you take that apart.

Bill
 
robin singal
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi



s is the set of parameters that i am appending to the 1st url and after flushing data to the url ,i would get response in 2nd url.
Actually if i consider the scenario in a browser what happens is:

When i enter the 1st url in the browser with the required parameters i am moved to success.asp with parameters appended to it .

What does "get in 2nd url" mean



The problem is that what i am able to do in the browser; i am unable to do it in the program ...i.e i am unable to get the respose which is displayed as text in the browser on success or as the get parameters (i.e par1 & par2) along with the url....

should i explain more...

thanks
 
robin singal
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I worked it out actually i was using


and should have used while loop instead of an if loop as i was getting the html code as response rather then plain text.

Sorry for taking your precious time.
well
Thanks to all.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by robin singal:
Hi
I worked it out actually i was using


and should have used while loop instead of an if loop as i was getting the html code as response rather then plain text.

Sorry for taking your precious time.
well
Thanks to all.



Hi Robin, thanks for sharing the solution with us, and you're not wasting our time, that's what the community is here for! We do try to nudge people into asking good questions with lots of detail though
 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic