Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

JSP : How to set a link with string parameter

Thread view: 
xbokZero@gmail.com - 07 May 2007 03:44 GMT
Hello there!

I am new to HTML and JSP. Trying to do as following:

<a href=Test?id="PID1 203" >2</a>
<br>
<a href=Test?id="PID2 ABC">7</a>

the resulting link url is

Test?id="PID1

and

Test?id="PID2

Both missing the second word. I must do the link in above format and I
have to pass the id exactly as "PID xxx yyy zzz nnn" and cannot
seperate them into different parameters.

TIA
Tom Hawtin - 07 May 2007 04:24 GMT
> <a href=Test?id="PID1 203" >2</a>
> <br>
[quoted text clipped - 3 lines]
>
> Test?id="PID1

Firstly, put attributes in single or double quotes. Secondly spaces
shouldn't appear in URLs. Normally they should appear escaped as %20. In
the case of a query string, + replaces space. So:

    <a href='Test?id="PID1+203"'>

Although, probably what you want is:

    <a href='Test?id=PID1+203'>

Tom Hawtin
Arne Vajhøj - 09 May 2007 02:04 GMT
>> <a href=Test?id="PID1 203" >2</a>
>> <br>
[quoted text clipped - 13 lines]
>
>     <a href='Test?id=PID1+203'>

Assuming it is in a JSP page then using URLEncoder.encode
would be a good thing.

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.