• 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

EL && Logic Operators

 
Ranch Hand
Posts: 193
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cannot find an understandable example of this anywhere, if this is obvious to everyone, I apologize.

I need to AND three variables. In Java, I would do this:



In EL, I tried these but with not luck:



and



Any help is appreciated. Thank you.
Higgledy
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that you need to put () around the three like you do in the original example
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The whole test needs to be one xml attribute value.
Try:
 
Higgledy Smith
Ranch Hand
Posts: 193
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. I cannot believe it was so obvious. With Java, you can lookup the availble methods for a class in the Java API. But with El and JSTL, there APIs don't seem to coorelate to methods or even make much sense.

Example:

c: relates to the jstl/core (JSTL TAG)
I look up the core API here> JSTL 1.1 API
But I cannot find any if or test, just a link to ConditionalTagSupport

So, how am I to know what is availble with the jstl librarby?

Thank you.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EL is covered in the JSP spec.

This FAQ entry has urls for downloading the JSP and JSTL specifications.

They're a good thing to have on your desktop when developing JSP pages.
 
Higgledy Smith
Ranch Hand
Posts: 193
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess I am dense. I listed the jstl.core, sub-sections below. How am to know from this that an if function is availble?

 
Higgledy Smith
Ranch Hand
Posts: 193
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I really am looking for is an if-else tag. You showed me how to do the <c:if...> but I did not want to post again asking how to do an if else. Trouble is I can't even find a reference to the if in the spec let alone the if else.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JavaDocs are generally the WORST place to get details on how to program with a java resource. They show the trees, but unless someone got ambitious, they don't show how the trees fit in the forest.

Try this URL: http://java.sun.com/j2ee/1.3/docs/tutorial/doc/JSTL5.html

Note that there IS no "else" logic tag. You have to either repeat the "if" with reversed logic or use the "otherwise" element on a single-test choose construct. This because of the way HTML/JSP/XML tags have to nest - there's no tidy way to do if/optional-else/endif coding.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One note to Tim's excellent post.
The c:otherwise tag works with the c:when tag, not the c:if tag.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic