You need to check for null parameter first:

String sPage = request.getParameter("Page");

if (sPage != null && !"".equals(sPage)) {

ChrisC

> -----Original Message-----
> From: Nicholas Orr [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 29, 2002 12:41 PM
> To: Tomcat Users List
> Subject: Dictate what happens when page loads based on the 
> Querry String
> 
> 
> Ok,
> 
> I type in the following url http://localhost/Forms/form.jsp
> 
> Now what should happen is it should do what is in the case 1 
> of the switch.
> 
> But it doesn't. It gets caught up on the fact that there is no Page
> paramater.
> 
> I have come from the world of asp, and something like this is achieved
> simply by doing this.
> 
> If len(request("Page")) < 0 Then
>   sPage = "1"
> End If
> 
> It doesn't matter if "page" is there or not, if page is there 
> in the form of
> form.asp?Page= then the length = 0 if it is form.asp then length = 0
> 
> How do you do this in java?
> 
> The reason I have the else in there is I have to convert sPage into a
> integer cause switch doesn't accept strings unlike VB's 
> Select which does.
> 
> 
> 
> **********************************************************************
> The information contained in this e-mail is confidential and is
> intended only for the use of the addressee(s).
> If you receive this e-mail in error, any use, distribution or
> copying of this e-mail is not permitted. You are requested to
> forward unwanted e-mail and address any problems to the
> MIM Holdings Limited Support Centre.
> 
> For general enquires: ++61 7 3833 8000
> Support Centre e-mail:        [EMAIL PROTECTED]
> Support Centre phone:         Australia 1800500646
>                                       International ++61 7 38338042
> **********************************************************************
> 
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to