Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 9th, 2005, 01:54 AM
Registered User
 
Join Date: Sep 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Check string value

Hi all,
I am trying to check String field if it is null or not to excute some commands.
But it is not working ... any help pls ??

String foryear = request.getParameter("foryear");
String decreeno = request.getParameter("decreeno");

I've tried to use :
if (decreeno.length() > 1)
sqlstr = sqlstr + " and decreeno='" + decreeno + "' ";
It is not working .

And when i've tried to use the follwoing :
if ( !foryear.equals( null ) )
sqlstr = sqlstr + " and foryear='" + foryear + "' ";
But I am getting Null Pionter Exeption.

Any Idea pls.

 
Old October 9th, 2005, 12:50 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

if (foryear != null);

.equals compares strings, you cannot use it to compare to null.






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check programmatically check the password? thomaskelly ASP.NET 1.0 and 1.1 Basics 1 May 16th, 2008 08:49 PM
Connect to VSS check-in Check-out Programatically rhd110 General .NET 6 August 12th, 2007 07:46 AM
Check two string values on a single variable?? ramesh.kumarm XSLT 2 June 29th, 2006 03:29 AM
Parsing string to check for substring bcamp1973 XSLT 2 June 5th, 2006 06:44 PM
Check if string is in element hykyit XSLT 3 May 1st, 2006 09:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.