Java
  Home arrow Java arrow Page 3 - 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 
Moblin 
JMSL Numerical Library 
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


    The JSP Files (part 2): Attack Of The Killer Fortune Cookies - Do It Or Else...


    (Page 3 of 6 )

    In addition to the "if" statement, JSP also offers the "if-else" statement, which allows you to execute different blocks of code depending on whether the expression is evaluated as true or false.

    The structure of an "if-else" statement looks like this:

    if (condition) { do this! } else { do this! }
    In this case, if the conditional expression evaluates as false, all statements within the curly braces of the "else" block will be executed. Modifying the example above, we have

    <%! // declare temperature variable int temp = 50; %> <% // check temperature and display output if (temp > 30) { out.println("Man, it's hot out there!"); } else { out.println("Well, at least it isn't as hot as it could be!"); } %>
    In this case, if the first past of the construct fails (temperature is *not* greater than 30), control is transferred to the second part - the "else" statement - and the code within the "else" block is executed instead. You can test both possibilities by adjusting the value of the "temp" variable, and viewing the resulting output in your browser.

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


     

       

    JAVA ARTICLES

    - New Object Initialization in Java
    - 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





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