JSP:
<%@ page import = "HelperBean"  %>
<%@ page contentType="text/html; charset=GBK" %>
<jsp: useBean id = "myHelperBean"
         class "helperBean" >
</jsp: useBean>
<html>
<head>
<title>
HelperBean
</title>
</head>
<body bgcolor="#ffffff">
<h1>
JBuilder Generated JSP
<%
    myHelperBean.setIntProperty(25);
    myHelperBean.setStringProperty("HELLO!");
%>
Value of intProperty is :
<%= myHelperBean.getIntProperty() %><BR>
Value of StringProperty is :
<%= myHelperBean.getStringProperty() %><BR>
</h1>
</body>
</html>

解决方案 »

  1.   

    类:
    package helperbean;public class HelperBean {  public HelperBean() {  }
      private int intProperty = -1;
      private String stringProperty = null;  public void setIntProperty (int value){
           intProperty = value;
      }   public int getIntProperty(){
           return intProperty;
       }   public void setStringProperty ( String value){
           stringProperty = value;
       }   public String getStringProperty(){
           return stringProperty;
       }
    }