Objective :
Beans in JSP

Beans are Java Programs that follows the following rules:
1. No Base Class
2. Member data should not be public
3. Should hava a default (Zero Argument) constructor
4. Should have persistent methods to get and set the data

Example :
package abc;
public class Name
{
	private String fname;
	private String lname;
	public Name()
	{
		fname = new String();
		lname = new String();
	}
	public String getFname()
	{
		return fname;
	}
	public void setFname(String fname)
	{
		this.fname =  fname;
	}
	public String getLname()
	{
		return lname;
	}
	public void setLname(String lname)
	{
		this.lname =  lname;
	}
}

Benefits of Beans in JSP
1. No Java Syntax
2. Convinient correspondance between request parameters and bean properties
3. Easy object  sharing

Using Beans in JSP:
1. <jsp:useBean .. /> : To create Bean objects is JSP
2. <jsp:setProperty .. /> : To define Bean Properties
3. <jsp:getProperty .. /> : To fetch Bean Properties









<jsp:useBean ../> : It is used to create Bean Objects within JSP.
Attributes are :
id : Specifies the object name
class : Specifies the object class
type : Specifies the object type
scope : Specifies the object scope (page/request/session/application)

Example :
<jsp:useBean class="abc.Name" id="x" />





<jsp:setProperty .. /> : To define Bean Properties
Attributes are :
name : Specifies Bean Object Name
property : Specifies the property to be defined
value : Specifies the property value

Example:
<jsp:setProperty name="x" property="fname" value="Manish" />
<jsp:setProperty name="x" property="lname" value="Jain" />

<jsp:getProperty .. /> : To fetch and display Bean Properties
Attributes are:
name : Specifies Bean Object Name
property : Specifies the property to be fetched
Example:
<jsp:getProperty name="x" property="fname"   /> 
<jsp:getProperty name="x" property="lname"  />


Example : jsp\class5
1. StringBean.java
	used by :StringBean.jsp

2.  
      SaleEntry1-Form.jsp 
	calls : SaleEntry1.jsp
	uses : SaleEntry.java (Bean)
	Logic:
	1. Fetch using request.getParameter
	**individually
	2. Convert it 
	(String to int, String to double)
	**individually	
	3. Store it in Bean.
	4. Fetch it from bean and display it.
3.  
      SaleEntry2-Form.jsp 
	calls : SaleEntry2.jsp
	uses : SaleEntry.java (Bean)

	Logic:
	1. Store it in Bean.
	individually specifying  param 	attribute ignoring getParameter and 	type-casting
	2. Fetch it from bean and display it.

4.  
      SaleEntry3-Form.jsp 
	calls : SaleEntry3.jsp
	uses : SaleEntry.java (Bean)


	Logic:
	1. Store it in Bean. (collectively)
	2. Fetch it from bean and display it.














































