You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Boaz Shaham <Bo...@farechase.com> on 2000/12/25 13:19:29 UTC

RE: how to include querystring in JSP

You cant have a space char in the query string; you need to encode it.
If the anchor tag itself is in a jsp page, you can write:

<A HREF="/examples/test.jsp?name=<%=java.net.URLEncoder.encode("hello
world")%>">

- Boaz

-----Original Message-----
From: Deepak C S [mailto:DeepakCS@planetasia.com]
Sent: Monday, December 25, 2000 14:20
To: 'JSP-INTEREST@JAVA.SUN.COM'
Cc: 'tomcat-user@jakarta.apache.org'
Subject: how to include querystring in JSP



 Hi,

	I want to include a querystring within an HTML anchor tag

eg:

<a href="/examples/test.jsp?name=hello world">  click </a>

but tomcat is giving JSP parse error as:

1)test.jsp(0,4) invalid argument

I even tried encoding the href as
response.encodeURL("/examples/test.jsp?name=hello world") 

eventhough everythgs written properly to html page,tomcat complains with
(0,4) error..invalid declaration.

can anybody let me know how to include querystring in links in JSPs??

thanx advance,

deeps