jsp:setProperty和jsp:getProperty动作到底怎么用

jsp:setProperty和jsp:getProperty动作:
马克- to-win:马克 java社区:防盗版实名手机尾号: 73203。
jsp:useBean动作获得Bean实例之后,要设置Bean的属性可以通过jsp:setProperty动作进行。读取Bean属性可以通过使用jsp:getProperty动作。



例 4.2.1
<html>
<head>
</head>
<body>
<form action="jsp1.jsp" method="POST">
count<input  type="text" name="count"/><br />
Email:<input  type="text" name="email"/><br />
age:<input  type="text" name="age"/>
<input  type="submit" value="submit"/>
</form>
</body>
</html>




<jsp:useBean id="count1" class="com.MyBean"/>
<jsp:setProperty name="count1" property="count" />
Count1:
<jsp:getProperty name="count1" property="count"/>



<jsp:setProperty name="count1" property="count" /> 会被转化成如下语句,就是从request当中找到count这个参数,赋给count1的count这个属性。
      JspRuntimeLibrary.introspecthelper(_jspx_page_context.findAttribute("count1"), "count", request.getParameter("count"), request, "count", false);