jsp---获得JavaBean的属性
程序员文章站
2024-01-18 17:00:34
<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>
摘自 张大鹏的博客
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>
摘自 张大鹏的博客