SunQuest
 
       Java
  Home arrow Java arrow Page 7 - The JSP Files (part 7): Bugs, Beans An...
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 7): Bugs, Beans And Banks
By: Vikram Vaswani and Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2001-04-18

    Table of Contents:
  • The JSP Files (part 7): Bugs, Beans And Banks
  • Bugathon
  • Exceptionally Clever
  • Bad News
  • You Throw(), I'll Catch
  • Bean Bag
  • Turning Up The Heat

  • 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 7): Bugs, Beans And Banks - Turning Up The Heat


    (Page 7 of 7 )

    In order to illustrate how this works, we've written a simple Bean which accepts temperature values and converts them between Celsius and Fahrenheit scales. Here it is:

    temperature.zip

    And here's a page which uses it:

    <html> <head> <basefont face="Arial"> </head> <body> <!-- initialize the Bean, set some defaults --> <jsp:useBean id="c" scope="page" class="Temperature"> <jsp:setProperty name="c" property="celsius" value="10" /> </jsp:useBean> <% // get the current temperature out.println("Temperature in Celsius is " + c.getCelsius() + "<p>"); // turn up the heat c.setCelsius(36.8); // get the current temperature out.println("Temperature in Celsius is now " + c.getCelsius() + "<p>"); // convert the temperature to Fahrenheit out.println(c.getCelsius() + " Celsius is " + c.convertCelsiusToFahrenheit(c.getCelsius()) + " Fahrenheit<p>"); // ...and back again out.println(c.getFahrenheit() + " Fahrenheit is " + c.convertFahrenheitToCelsius(c.getFahrenheit()) + " Celsius<p>"); %> </body> </html>

    And here's the output:

    Temperature in Celsius is 10.0 Temperature in Celsius is now 36.8 36.8 Celsius is 98.24 Fahrenheit 98.24 Fahrenheit is 36.8 Celsius

    And that's about it for the moment. In the next - and final - article in this series, we'll be exploring JSP's tag libraries, which allow Web designers to add powerful funtionality to their Web pages without knowing JSP. Make sure you make it out here for that one!
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

       

    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 3 hosted by Hostway