Java
  Home arrow Java arrow Page 5 - The JSP Files (part 2): Attack Of The ...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

The JSP Files (part 2): Attack Of The Killer Fortune Cookies
By: Vikram Vaswani and Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2001-02-22

    Table of Contents:
  • The JSP Files (part 2): Attack Of The Killer Fortune Cookies
  • Flavour Of The Month
  • Do It Or Else...
  • Cookie-Cutter Code
  • Lunch In Milan
  • Switching Things Around

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    The JSP Files (part 2): Attack Of The Killer Fortune Cookies - Lunch In Milan


    (Page 5 of 6 )

    If you take a close look at the last-but-one example above, you'll notice that the conditional expression

    (temp < 25 && temp > 10)

    is slightly different from the ones you've been used to thus far. This is because JSP also allows you to combine multiple conditions into a single expression, with the help of an animal called a "logical operator".

    The following table should make this clearer.

    Assume delta = 12, gamma = 12 and omega = 9
    Operator What It Means ExampleEvaluates To
    && ANDdelta == gamma && delta > omega delta equals gamma AND delta is greater than omega
    True && ANDdelta == gamma && delta < omegadelta equals gamma AND delta is less than omega
    False || OR delta == gamma || delta < omega delta equals gamma OR delta is less than omega
    True || OR delta > gamma || delta < omega delta is greater than gamma OR delta is less than omega
    False ! NOT !deltadelta doesn't exist

    So, instead of something as ugly as this

    <% if (day == "Thursday") { if (time == "12") { if (place == "Italy") { lunch = "pasta"; } } } %>
    you could have something as elegant as this.

    <% if (day == "Thursday" && time == "12" && place == "Italy") { lunch = "pasta"; } %>

    More Java Articles
    More By Vikram Vaswani and Harish Kamath, (c) Melonfire


     

       

    JAVA ARTICLES

    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup

    BlackBerry VTS




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway