• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using c:if ,logic:empty to check existence of bean data

 
lohithbusi reddy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have set the properties of bean to null. I want to check it using <c:if> or <logic:empty>, I should not use any properties of the bean in these tags.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a question or an issue?

- Brent
 
lohithbusi reddy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is an issue for me. Plz help
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no built-in function either in the Struts <logic:xxx> tags or in JSTL to check whether all the properties of a bean are null. You would have to write such a function yourself.

In the bean, just write a method isAllPropertiesNull() that returns true if all properties are null, and false if they aren't.

Then in your jsp:

<if test="${myBean.allPropertiesNull}">
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic