Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 9th, 2005, 01:54 AM
Registered User
 
Join Date: Sep 2005
Location: , , .
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.

Reply With Quote
  #2 (permalink)  
Old October 9th, 2005, 12:50 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:22 AM.


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