1:setSample中“Sample"只是个便于理解的名字,与sample = newValue中“sample”没直接关系。
2:void 指此方法无返回值

解决方案 »

  1.   

    “Sample”和sample没有任何关系void ----无返回值
      

  2.   

    问题1,按理说,我把这setSample和getSample都改成setSampleAbc和getSampleAbc,然后再编译,效果应该和原来一样,可是却出错,不知为什么?
      

  3.   

    “Sample”是不是Bean的属性名?
      

  4.   

    不是 setSample后的 Sample 与属性sample没任何关系
      

  5.   

    lfslfslfs(li mou) :
    编译是没有问题,但jsp文件调用出了问题:
    aaa.jsp源文件如下:
    ------------------------------
    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>在JSP中使用JavaBeans</title>
    </head>
    <jsp:useBean id="sample1BeanId" scope="session" class="Bean.sample1Bean"/>
    <jsp:setProperty name="sample1BeanId" property="*"/>
    <body>
    A JSP & Bean Sample
    <br><br>
    <form method="post">
    Enter new value:<input name="sample"><br><br><br>
    <input type="submit" name="submit" value="submit">
    <br>
    Value of Bean property is:<jsp:getProperty name="sample1BeanId" property="sample"/>
    </form>
    </body>
    </html>
    -------------------------------
      

  6.   

    lfslfslfs(li mou) :
    到底哪一个是属性:Sample还是sample?
    我看书上好像是说Sample