Solved

Using tag library to check if  a object is null

Posted on 2004-04-08
2
2,413 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Apache server configuration 7 80
java cyclic graphs 15 201
doubleChar java challenge 7 102
How can I   ajax html table  rows? 20 63
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Knowledge base software has turned out to be a quite reliable method for storing information, promoting collaborative work and for sharing valuable input and solutions.However, some organizations are trying to develop a knowledge base that works wit…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now