将ID为“cart”的BEAN的各属性附值,值为请求表单的各对应值。

解决方案 »

  1.   

    赋值是怎么进行的,property="*" 代表赋值过程吗?
      

  2.   

    property="*" 代表将请求表单中对应的值赋到BEAN的各属性中。如:
    提交的表单中有一名为“id”的字段,则会将其值赋给BEAN中对应的属性“id”。
      

  3.   

    下面这段代码是怎么工作的呢,搞不清楚啊
    <%@ page contentType="text/html; charset=GBK" %>
    <html>
    <head>
    <title>
    index
    </title>
    </head>
    <jsp:useBean id="indexBeanId" scope="session" class="textdatafile.indexBean" />
    <jsp:setProperty name="indexBeanId" property="*" />
    <body>
    <h1>
    JBuilder Generated JSP
    </h1>
    <form method="post">
    <br>Enter new value   :  <input name="sample"><br>
    <br><br>
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" value="Reset">
    <br>
    Value of Bean property is :<jsp:getProperty name="indexBeanId" property="sample"/>
    </form>
    </body>
    </html>
    package textdatafile;public class indexBean {
      private String sample00= "Start value";
      //Access sample property
      public String getSample() {
        return sample00;
      }
      //Access sample property
      public void setSample(String newValue) {
        if (newValue!=null) {
          sample00 = newValue;
        }
      }
    }
      

  4.   

    此处jsp:setProperty name="indexBeanId" property="*" 作用相当于
    类indexBean 调用setSample()给sample00 赋值,
    然后用jsp:getProperty name="indexBeanId" property="sample"将sample00的值取出
      

  5.   

    可是,jsp:getProperty name="indexBeanId" property="sample"  是怎么识别sample00的值的呢? 明明property="sample"