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

2.jsp:setProperty和jsp:getProperty动作:
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);
 

更多内容请见原文,文章转载自:https://blog.csdn.net/qq_44594371/article/details/103167959

上一篇:blk_update_request: I/O error, dev fd0, sector 0


下一篇:pageContext,Request,Session,servletContext,类变量,局部变量六个范围的区别?