其他分享
首页 > 其他分享> > jsp:setProperty和jsp:getProperty动作到底怎么用举例?

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

标签:count,getProperty,request,Bean,jsp,setProperty
来源: https://www.cnblogs.com/malala/p/15853524.html