This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes simple struts conditional? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "simple struts conditional?" Watch "simple struts conditional?" New topic
Author

simple struts conditional?

Brett Han
Greenhorn

Joined: May 17, 2005
Posts: 10
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.
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
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 ]

-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
<logic:equal name="className" attribute="methodWhichReturnsTrueorfalse" value="true/false">
</logic:equal>

Write html/struts/jsp code in between the tag
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: simple struts conditional?