Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: help with a bean please


Message #1 by "matt" <mattslists@o...> on Thu, 28 Dec 2000 12:57:06 -0000
This is a multi-part message in MIME format.

------=_NextPart_000_000B_01C07199.A1C60CA0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

public String getCookieExists(){
    String strStatus =3D "no errors";
    Cookie info;
    try{
    if (request.getCookies() !=3D null){
        Cookie[] cookies =3D request.getCookies(); //null exception from 
here
         if (cookies !=3D null && cookies.length !=3D0){         //if 
(cookies.length !=3D0 && cookies !=3D null){
            for (int i =3D 0; i < cookies.length ; i++){
                info =3D cookies[i];
                if (info !=3D null){
                    strStatus =3D 
info.getName().equals(strCookieLookingFor) &&
                    strCookieLookingFor !=3D null ? "exists" : "doesnt 
exist";
                }
            }
        }
    }
}
catch(Exception e){
    strStatus =3D (e.toString() + " <b>(from bean)</b>");
}
return strStatus;
}


----- Original Message -----
From: "matt" <mattslists@o...>
To: "Pro_JavaServer_Pages" <pro_jsp@p...>
Sent: Thursday, December 28, 2000 7:57 PM
Subject: [pro_jsp] help with a bean please


> can anyone tell me why this throws a java.lang.NullPointerException ?
>
> public String getCookieExists(){
>   String strStatus =3D "no errors";
>   Cookie info;
>   try{
>    if (request.getCookies() !=3D null){
>     Cookie[] cookies =3D request.getCookies(); //null exception from 
here
>     if (cookies.length !=3D0 && cookies !=3D null){
>      for (int i =3D 0; i < cookies.length ; i++){
>       info =3D cookies[i];
>       if (info !=3D null){
>        strStatus =3D info.getName().equals(strCookieLookingFor) &&
> strCookieLookingFor !=3D null ? "exists" : "doesnt exist";
>       }
>      }
>     }
>    }
>   }
>   catch(Exception e){
>    strStatus =3D (e.toString() + " <b>(from bean)</b>");
>   }
>
>   return strStatus;
>  }
>
>
> ---
> NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE okay?
> Visit EarthWeb for the latest in IT Management, Software Development,
> Web Development, Networking & Communications, and Hardware & Systems.  

> Click on http://www.earthweb.com for FREE articles, tutorials,
> and discussions from the experts.
leave-pro_jsp-$subst('Recip.MemberIDChar')@p2p.wrox.com
>
>


--- 
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development, 
Web Development, Networking & Communications, and Hardware & Systems.  
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.
---
You are currently subscribed to pro_jsp as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-pro_jsp-$subst('Recip.MemberIDChar')@p2p.wrox.com




  Return to Index