pranav kumar wrote:
>
> Hello Everybody,
>                            My problem is about the value passing through the
> querystring method.
>       For Ex.
>                   click on the following links
>                   1. Very Good
>                   2. Very Bad
>                   3. Very Nice
> Now what I want that when user click on any one of the above links then
> value should pass to the next page (Like 'Very Good' or 'Very Nice' or '
> Very Bad').
>   On the next page I am using the getQueryString() method for getting the
> value. But the problem is that I get the value Like ' Very%20Good'.
>          Is there any method or way by which I can get the original value
> without '%20' it means 'Very Good' . Please give some another solution
> except Java String manipulations (like substring() etc.).
>    Query String doesn't have a fixed format. It may contain any number of
> spaces or '-' or any character.

I suggest that you use the getParameter() or getParameterValues() methods
instead. They handle the decoding of parameter values for you, and they
work no matter if the parameter is sent in a query string or as part of
the request body (i.e. using a POST request).

An even better approach is to develop a bean that takes care of all
parameters. If the parameter name is "message", a simple bean with

  public void setMessage(String message)
  public String getMessage()

methods can be used to handle all of it for you without any Java code in
the JSP page:

  <jsp:useBean id="myBean" class="com.mycomp.MyBean" />
  <jsp:setProperty name="myBean" property="*" />

  You selected: <jsp:getProperty name="myBean" property="message" />


Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to