-----Mensaje original-----
De: Guilherme - PerConsult <[EMAIL PROTECTED]>
Para: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Fecha: jueves 16 de diciembre de 1999 15:20
Asunto: request a value from a url


>Hello!
>
>How can I get a value from an URL? For instance:
>
>In the address bar I have
>http://www.test.com?brazil=carnival
>
>the string "brazil"  has the value "carnival"  ... how can I get this
>value from the address bar?
>
>Thanks!!!!
>
>
>   Guilherme dos Santos Tsubota
>   _________________________________
>   Perrotti Informatica - PerConsult
>   Sao Paulo - SP - Brazil
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html

You can do this:

<% String variable = request.getParameter("brazil"); %>

or

<% String variable = request.getParameterValues("brazil")[0];%>
At the end, the string variable has the value "carnival".

When you use "<%        String variable = request.getParameter("brazil");
%>", you get only one value.
The method "getParameterValues" returns all the values in an array of
strings. In the example, we want only one value, then, we get the first
element of the array.
--
Saludos:

Sergio Queijo Diaz
[EMAIL PROTECTED]
Uni�n Fenosa International SW Factory
Pedro Teixeira n8. 28020 Madrid. SPAIN
Tlf. +34915553361 http://www.uf-isf.es

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to