Solved

Using tag library to check if  a object is null

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Each year, investment in cloud platforms grows more than 20% (https://www.immun.io/hubfs/Immunio_2016/Content/Marketing/Cloud-Security-Report-2016.pdf?submissionGuid=a8d80a00-6fee-4b85-81db-a4e28f681762) as an increasing number of companies begin to…
February 24, 2017 — On February 23, Travis Ormandy, a vulnerability researcher at Google, reported on Twitter (https://twitter.com/taviso/status/834900838837411840) that massive stores of data have been leaked by CloudFlare, a company that provide…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

810 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