<jsp:getProperty name="" property=""/>
01
<%@page language="java" contentType="text/html;charset=gb2312"%>
02
<!DOCTYPE html>
03
<html>
04
<head>
05
<title>獲取JavaBean屬性</title>
06
</head>
07
<body>
08
<%--通過useBean動作指令調用JavaBean--%>
09
<jsp:useBean id="user" scope="page" class="com.javaweb.ch07.UserBean"></jsp:useBean>
10
<%--根據所有的參數設置JavaBean中屬性--%>
11
<jsp:setProperty name="user" property="username" value="Devidpeng"/>
12
<jsp:setProperty name="user" property="password" value="zhangdapeng"/>
13
<jsp:getProperty name="user" property="username" />
14
<jsp:getProperty name="user" property="password" />
15
</body>
16
</html>
摘自 張大鵬的博客