• 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

Break out of a logic block using logic tags

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At last, I have a legitimate question! Is there a way to break out of a logic block if a value is not present?
I can't paste the exact code, but the logic is:

I don't want the table to show up if the result set from the database is an empty set. I haven't noticed an else, break, or {shudder} goto or anything like that, so I'm wondering what to do...
Thanks...
{I know there is a space in my code on the present tags, but when you put the : and p together, you get , which, by the way is how I feel about STRUTS... } )
[ September 18, 2002: Message edited by: Sam Smoot ]
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like the way to go about this is to use the < logic : present > tag to do one thing and the < logic : notPresent > tag to do the other. Check out this for examples of those tags.
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doesn't work.. I have a present and notpresent tag block (which work fine), but I reuse the same page for presentation.
When the page is invoked, I look for the result set. If it is present, then I print the table, but if nothing is returned I don't want the table to show. If the resultSet is not present, (First Pass through the page) then I tell the user to enter the data for the search to return a result set (which could be empty).
I've been told to use STRUTS..... I could just use if(resultSet != null), but that isn't STRUTS... If it makes sense, then it isn't STRUTS....
Can you tell I'm not real happy?
THanks.
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would something like this work?

Are you actually using a ResultSet object in your JSP, or is this some java bean that you just happened to name resultSet? Just curious.
[ September 18, 2002: Message edited by: Jason Menard ]
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way, to get rid of you can turn on
"Disable smilies in this post" option in post submitting form, it's under list of all smiles, and under "Show Signature".
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Disable smilies in this post" ?? Can't do that!! I need the extra to make my point..
Yeah, it's a bean, not the actual set, but you got the idea.. Also, I didn't see the notEmpty... it works...
Thanks!
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think You should try using
<logic:notEmpty> and </logic:notEmpty> along with <logic:Empty> and </logic:Empty>.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic