public class MyJavaBean {
  private String str;}

解决方案 »

  1.   

    晕死,不小心提交了,继续写
    public class MyJavaBean {
      private String str;
      
      public void setStr (String str) {
        this.str = str;
      }  public String getStr () {
        return this.str;
      }
    }
      

  2.   

    晕。good good study,day day up。
      

  3.   

    //firstbean.java
    public class  firstbean
    {
    String Product;
    double Price;
    public firstbean()
    {
    this.Product="apple";
    this.Price=2.5;
    }
    public void setProduct(String ProductName)
    {
    this.Product=ProductName;
    }
    public String getProduct()
    {
    return(this.Product);
    }
    public void setPrice(double PriceValue)
    {
    this.Price=PriceValue;
    }
    public double getPrice()
    {
    return(this.Price);
    }
    }
    firstbean.jsp
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head><body>
    <jsp:useBean id="firstbean" scope="session" class="firstbean" />
    <%
        firstbean.setProduct("apple");
        firstbean.setPrice(5.23232);
        String product=firstbean.getProduct();
        out.println("产品:"+product+"<br>");
        double Price=firstbean.getPrice();
        out.println("价格:"+Price);
    %>
    </body>
    </html>