HelloWorld.java
public class HelloWorld{
private String name="hello";
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
}
hiBean.jsp
<html>
<head><title>JavaBeantest </title></head>
<body>
<jsp:useBean id="helloBean" scope="session" class="hello.HelloWorld"/>
<%= helloBean.getName() %> <%helloBean.setName("check"); %>
<%= helloBean.getName() %>
</body>
</html>