Loading values into a select field doesn�t set the value of it. So if the
user doesn�t choose anything, the onChange event is not sent to the select
field and when submit, the field prog_name has no value. I can�t remember if
not having value makes the field not to be included in the url as parameter.
But if no value is selected you can�t ask for them. Ask first for the
existence of the parameter, then for its values. Here is a reference for
that method in javax.servlet.ServletRequest interface. 

REFERENCE________________________
getParameterValues
public java.lang.String[] getParameterValues(java.lang.String name)
        Returns an array of String objects containing all of the values the
given request parameter has, or null if the parameter does not exist. For
example, in an HTTP servlet, this method returns an array of String objects
containing the values of a query string or posted form. 
        If the parameter has a single value, the array has a length of 1.
Parameters: 
        name - a String containing the name of the parameter whose value is
requested 
Returns: 
        an array of String objects containing the parameter's values 
See Also: 
        getParameter(java.lang.String)
<../../javax/servlet/ServletRequest.html>






> -----Mensaje original-----
> De:   Venkat [SMTP:[EMAIL PROTECTED]
> Enviado el:   viernes 14 de marzo de 2003 10:18
> Para: [EMAIL PROTECTED]
> Asunto:       Null pointer Exception while sending multiple list options
> 
> Hi all,
> I am sending multiple list options from one jsp to another.
> 
> in my first jsp i am retrieving values from db and and displaying to user
> to
> select them.
> <SELECT NAME="prog_name" SIZE=3 MULTIPLE>
> 
> while(rs.next()){
> String str=rs.getString("prog_name");
> out.println("<OPTION VALUE="+str+">"+str+"</OPTION>");
> }
> </select>
> 
> I am retrieveing the selected (more than one or at least one)which user
> selects to my second jsp page
> 
> 
> try{
> String[] prog=null;
> prog=request.getParameterValues("prog_name");
> }catch(Exception e){}
> 
> 
> this works fine when user select at least one value.But if he doesn't
> selects anything
> i am getting null pointer exception.
> 
> Can any one help me where i went wrong.
> 
> Thanks in advance
> venkat
> 
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> 
> Some relevant archives, FAQs and Forums on JSPs can be found at:
> 
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to