logic:empty tag for arrays
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   dovle_kid
Posted On:   Monday, February 14, 2005 07:20 AM

Hi all, I have all the business logic implemented using arrays (all the methods return arrays, not collection classes). This looked quite safe to me when I have started the project. Now I have hit a minor problem. As far as I can see from the Docs, the tag will not work with arrays!!! It works only with colection classes, using the isEmpty() method. Do you know a workaround? How can I check if the array is empty? (array.length==0). I would like to avoid using scriptlets :)). I must also confess that I don't use the Struts-EL version. ALSO: If you think using arrays as return type in business logic is bad and you also have some comments on this, you are welcome to tell me your thoughts.    More>>

Hi all,


I have all the business logic implemented using arrays (all the methods return arrays, not collection classes). This looked quite safe to me when I have started the project.


Now I have hit a minor problem. As far as I can see from the Docs, the tag will not work with arrays!!! It works only with colection classes, using the isEmpty() method.


Do you know a workaround? How can I check if the array is empty? (array.length==0). I would like to avoid using scriptlets :)). I must also confess that I don't use the Struts-EL version.


ALSO: If you think using arrays as return type in business logic is bad and you also have some comments on this, you are welcome to tell me your thoughts.


Thanks in advance,

Dovle

   <<Less

Re: logic:empty tag for arrays

Posted By:   Chris_Melville  
Posted On:   Monday, February 14, 2005 07:37 AM


Yep, don't think it will work the way you want. Probably best to ensure the arrays are null if empty, and then check that with the logic:present tag...



Depends how you are setting up the pages. Are you accessing the business logic in the action and then populating an array for display by the JSP? Or do you have one bean with lots of arrays as members? The first case is easy, the second case harder :)

About | Sitemap | Contact