• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to check against null

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to check for null for one of my request attributes. Consider this , In my login page i check for a request attribute which contains the message saying whether the user is invalid. That is for normal login and specifying invlid login i am using same JSP. If the user is invalid, I set a request attribute with a message. For this i need to check for the request attribute itself for null. How can i check this using logic:equal tag or c:if tags. i dont want to use scriptlets.

Basically in any scope how can i check a value or an attribute for null using logic:equal or c:if or other tag

please help me on this regard.

regards,
Surendar prabu.R
[ April 12, 2007: Message edited by: surendar prabu ]
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Surendar,

You can use <logic:notEmpty> struts tag to evaluate the nested body content of this tag if the requested variable is neither null, nor an empty string, nor an empty java.util.Collection.

<c:if test="${empty param.XXXXX}">

Also the above core tag <c:if>, will test whether the request parameter XXXXX is empty. It will True if the request parameter named XXXXX is null or an empty string.


Thanks,
Mahesh

--------

SCJP 1.4 | SCWCD 1.4 | SCBCD 1.3 | SCEA Part I - Preparing...
 
Mahesh Desai
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Surendar,

You can use <logic:notEmpty> struts tag to evaluate the nested body content of this tag if the requested variable is neither null, nor an empty string, nor an empty java.util.Collection.

<c:if test="${empty param.XXXXX}">

Also the above core tag <c:if>, will test whether the request parameter XXXXX is empty. It will return True if the request parameter named XXXXX is null or an empty string.


Thanks,
Mahesh

--------

SCJP 1.4 | SCWCD 1.4 | SCBCD 1.3 | SCEA Part I - Preparing...
 
Message for you sir! I think it is a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic