Following example shows how to use Bean related actions in a JSP page.

Java Code:
<HTML>
<jsp:declaration>
//thisisalocal"helper"beanforprocessingtheHTMLform
static public class localBean
{
private String value;
public String getValue(){return value;}
public void setValue(String s){value=s;}
}
</jsp:declaration>
<jsp:useBean id="localBean" scope="page" class="localBean">
<%--Every time we create the bean, initialize the string--%>
<jsp:setProperty name="localBean" property="value" value="World"/>
</jsp:useBean>
<%--Whatever HTTP parameters we have,
try to set ananalogous bean property--%>
<jsp:setProperty name="localBean" property="*"/>
<HEAD><TITLE>Hello World w/ JavaBean</TITLE></HEAD>
<BODY>
<CENTER>
<P><H1>Hello
<jsp:getProperty name='localBean' property='value'/></H1></P>
<FORM method=post>
Enter a name to be greeted:
<INPUT TYPE="text" SIZE="32" NAME="value"
VALUE="<jsp:getProperty name='localBean' property='value'/>">
<BR>
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
</CENTER>
</BODY>
</HTML>