• 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

simple struts conditional?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All I want to do is something like this in my jsp:



Is there any struts logic tag (or any other easy way) that can handle this? I was looking at <logic:equals>, so I'd have something like



But based on the documentation I can't find what some_attribute can be. Every choice seems to refer to some property of the bean, or request parameters, or cookie. There must be some way to simply compare it to a little snippet of java code as in the above, no?

Thanks for any help.
 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you need to treat SomeClass as a bean and the isSomeStaticMethod() as a method in that bean and pass that to your jsp.

you logic:equals then will have to have 2 additional attributes: name="beanIdReferToSomeClass" and property="someStaticMethod". your method must follow the javabean naming convention, that would be isSomeStaticMethod().
[ June 24, 2005: Message edited by: alan do ]
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<logic:equal name="className" attribute="methodWhichReturnsTrueorfalse" value="true/false">
</logic:equal>

Write html/struts/jsp code in between the tag
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic