aspose file tools*
The moose likes Servlets and the fly likes get value from url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "get value from url" Watch "get value from url" New topic
Author

get value from url

Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Hi,

www.mywebsite.com/updateuser.jsp?username=xxxx?aptno=yyyyy

When someone click this url Its opens updateuser.jsp. There is an ACCEPT (submit) button inside the <FORM> on the screen and when we press the ACCEPT I am opening a servlet. On doGet I am trying to get the username and aptno with getparameter. But I am getting NULL values.

Can you please suggest me how to get those value from that URL to my servlet.

It will be great if you can point to some materail too.

Thanks in advacne
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874


Try to do like this.

http://www.mywebsite.com/updateuser.jsp?username=xxxx&aptno=yyyyy
[ October 30, 2005: Message edited by: Adeel Ansari ]
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Thankyou..I mean

http://www.mywebsite.com/updateuser.jsp?username=xxxx&aptno=yyyy

Whats happening is my url is getting change to

http://www.mywebsite.com/Sherwood/updateuser?submit=Accept, when I am pressing Accept button. So my servlet getparameter() return null value.

Please suggest...

Thanks
Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
Common practices include making the parameters you want to include in the form submission as hidden form fields. Or, you can store the parameters in a session scope java bean. There are other methods like storing in database or cookies, but all of them got pros and cons you might need to consider.


SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Exactly what is the code you are using to try to get a parameter from that URL?
A single misspelling or difference in UPPER/lower case use will cause you to get a null value.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get value from url