当前位置: 代码迷 >> Java Web开发 >> jsp中出现the local variable zhang is never read求大神见教
  详细解决方案

jsp中出现the local variable zhang is never read求大神见教

热度:3689   发布时间:2013-02-25 21:14:59.0
jsp中出现the local variable zhang is never read求大神指教
<%@page contentType="text/html;charset=gb2312" %>
<%@page import="st.Student" %>

<html>
 <body bgcolor="yellow">
  <Form Action="" Method="post"> 
  <p>输入学生的姓名:
  <input type="text" name="name">
  <p>输入学生的学号:
  <input type="text" name="number">
  <p>输入学生的身高:
  <input type="text" name="height">
  <p>输入学生的体重:
  <input type="text" name="weight">
  <br>
  <input type="submit" name="提交">
  </Form>
   
  <jsp:useBean id="zhang" class="Student" scope="page"/>
   
  <jsp:setProperty name="zhang" property="name" param="name"/>
  <p>名字是:
  <jsp:getProperty name="zhang" property="name"/>
  <jsp:setProperty name="zhang" property="number" param="number"/>
  <p>学号是:
  <jsp:getProperty name="zhang" property="number"/>
  <jsp:setProperty name="zhang" property="height" param="height"/>
  <p>身高是:
  <jsp:getProperty name="zhang" property="height"/>
  <jsp:setProperty name="zhang" property="height" param="weight"/>
  <p>体重是:
  <jsp:getProperty name="zhang" property="weight"/>
  </body>
</html>


------解决方案--------------------------------------------------------
<jsp:useBean id="zhang" class="st.Student" scope="page"/>
------解决方案--------------------------------------------------------
这是什么代码。name全是zhang,param应该改成value

<jsp:useBean id="zhang" class="Student" scope="page">
<jsp:setProperty name="name" property="id" value="name"/>
</jsp:userBean>
  相关解决方案