JSP : How to set a link with string parameter

X

xbokZero

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
 
T

Tom Hawtin

<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

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
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Tom said:
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'>

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

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top