Solved

Using tag library to check if  a object is null

Posted on 2004-04-08
2
2,419 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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
trouble with PDF encryption using itext-1.3.1 17 88
Display current date,month,and year to JTextField 3 63
servlet concurrency 13 116
dao vs facade design patterns 2 31
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

763 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