Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Using tag library to check if  a object is null

Posted on 2004-04-08
2
2,417 Views
Last Modified: 2007-12-19
I would like to use the tag library to see if  the object is null.
The object is set in the session. In my JSP I get the object from the session.
The first thing i want to do is check if it is null- it it is nulll i print a message otherwise i go ahead and do some other stuff
this is what i have:
<logic:equal parameter="customers" value="null">  
      <B> Search string returned 0 records </B>
      </logic:equal>

<logic:notEqual parameter="customers" value="null">  
      //DO HTML STUFF
      </logic:notEqual>

I have a lot of HTML in my JSP - hece i did not use an if-else condition as it was tooconfusing.
Could someone help out with this or give me some info as to how i canuse if-else , i think i am messing up with the braces
thanks
0
Comment
Question by:aswam1975
  • 2
2 Comments
 
LVL 7

Expert Comment

by:searlas
ID: 10785189
use logic:present, not logic:equal

<logic:present parameter="customer">
<B> Search string returned 0 records </B>
</logic:present>

<logic:notPresent parameter="customers">  
     //DO HTML STUFF
</logic:notPresent>
0
 
LVL 7

Accepted Solution

by:
searlas earned 30 total points
ID: 10785202
If you're really storing things in the session (which has nothing to do with parameter) then use logic:empty and logic:notEmpty

<logic:empty name="yourbean" scope="session">
...
</logic:empty>

and/or

<logic:empty name="yourbean" property="someprop" scope="session">
....
</logic:empty>
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
error when compiling my project in eclipse luna 30 448
lessBy10  challenge 15 95
How can I   ajax html table  rows? 20 78
Why my table column Id is not passed to java object? 4 44
IT certifications are a concrete representation of continual learning on the part of the candidate.  Continual learning is necessary for the long term success of an IT professional, but are IT certifications the right path for you?
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question