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.

Recommended Answers

All 2 Replies

I think we need some more information before we can help.

Are you trying to do all this behavior in one jsp?

What does your code look like.

What is the full exception stack trace?

Regards,

Nate

Use JSTL and it's a breeze.

And indeed you shouldn't do SQL and any other non-display related stuff in a JSP.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.