Source Code : Get Set Properties JSTL

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Get Set Properties JSTL

//File: index.jsp

<html>
    <head>
        <title>Using a JavaBean</title>
    </head>
    <body>

    <h2>Using a JavaBean</h2>

    <jsp:useBean id="myCar" class="beans.CarBean" />

    I have a <jsp:getProperty name="myCar" property="make" /> <br />

    <jsp:setProperty name="myCar" property="make" value="Ferrari" />
 

    Now I have a <jsp:getProperty name="myCar" property="make" />

    </body>
</html>


//////////////////////////////////////////////////////////////
//Java Bean
package beans;

import java.io.Serializable;

public class CarBean implements Serializable 
{
  private String make = "Company";
  private double cost = 100.00;
  private double taxRate = 17.5;

  public CarBean() {}

  public String getMake()
  {
    return make;
  }

  public void setMake(String make)
  {
    this.make = make;
  }

  public double getPrice()
  {
    double price = (cost + (cost * (taxRate/100)));
    return price;
  }

}

           
       

Thank with us