
how can we use beans in jsp

JSP provides three tags to work with beans:-
<jsp:useBean id="bean name" class"bean class" scope = "page | request | session|application "/>
Bean name = the name that refers to the bean.Bean class = name of the java class that defines the bean.
<jsp:setProperty name = "id" property = "someProperty" value = "someValue" / >
id = the name of the bean as specified in the useBean tag.property = name of the property to be passed to the bean.value = value of that particular property .
<jsp:getProperty name = "id" property = "someProperty" />
Here the property is the name of the property whose value is to be obtained from thebean.Below is a code snippet which shows how MyUserClass is used and the valuesaccessed.
For more information, visit the following link:
http://www.roseindia.net/jsp/simple-jsp-example/UseBean.shtml
<jsp:useBean id="user" class="MyUserClass" scope="session"/> <HTML> <BODY>You entered<BR> Name: <%= user.getUsername() %> <BR>Email: <%= user.getEmail() %><BR> </BODY> </HTML>

JSP provides three tags to work with beans:-
<jsp:useBean id="bean name" class"bean class" scope = "page | request | session|application "/>
Bean name = the name that refers to the bean.Bean class = name of the java class that defines the bean.
<jsp:setProperty name = "id" property = "someProperty" value = "someValue" / >
id = the name of the bean as specified in the useBean tag.property = name of the property to be passed to the bean.value = value of that particular property .
<jsp:getProperty name = "id" property = "someProperty" />
Here the property is the name of the property whose value is to be obtained from thebean.Below is a code snippet which shows how MyUserClass is used and the valuesaccessed.
<jsp:useBean id="user" class="MyUserClass" scope="session"/> <HTML> <BODY>You entered<BR> Name: <%= user.getUsername() %> <BR>Email: <%= user.getEmail() %><BR> </BODY> </HTML>
For more information, visit the following link:
http://www.roseindia.net/jsp/simple-jsp-example/UseBean.shtml