JSP JavaBean的setProperty属性
时间:2023-07-10 19:58:11
1.包:
package PaintBrush;
/**
*
* @author lucifer
*/
public class PaintBrush {
private String curcolor = "red";
public String getColor(){
return curcolor;
}
public void setColor(String color){
curcolor = color;
}
}
2.JSP代码:
<%--
Document : TestSetPro
Created on : 2009-10-3, 15:02:50
Author : lucifer
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="brush" class="PaintBrush.PaintBrush"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
Original Color:
<jsp:getProperty name="brush" property="color"/>
<br>
Changed Color:
<jsp:setProperty name="brush" property="color" value="blue"/>
<jsp:getProperty name="brush" property="color"/>
</body>
</html>
3.输出:
Original Color: red
Changed Color: blue
标签:JSP,JavaBean,setProperty
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python如何通过subprocess调用adb命令详解
2023-03-30 13:10:19
python入门基础之用户输入与模块初认识
2022-08-13 01:10:21
numpy之多维数组的创建全过程
2023-06-22 03:58:03
![](https://img.aspxhome.com/file/2023/0/112770_0s.png)
让文本框textarea自动适应内容的高度
2008-07-01 14:44:00
go-cqhttp环境配置及安装过程
2024-04-26 17:30:46
![](https://img.aspxhome.com/file/2023/1/134021_0s.png)
表单系列·出错字段排行榜
2008-07-01 12:57:00
flask重启后端口被占用的问题解决(非kill)
2021-06-24 16:11:24
Python的线程之线程同步
2021-02-05 23:23:32
![](https://img.aspxhome.com/file/2023/5/135145_0s.jpg)
配置SQL Server以允许远程连接
2010-03-08 13:12:00
原生JS封装_new函数实现new关键字的功能
2023-09-05 00:44:27
![](https://img.aspxhome.com/file/2023/1/56041_0s.png)
mysql服务无法启动报错误1067解决方法(mysql启动错误1067 )
2024-01-16 03:23:26
![](https://img.aspxhome.com/file/2023/5/116765_0s.png)
Python实现基于C/S架构的聊天室功能详解
2022-06-14 11:43:38
![](https://img.aspxhome.com/file/2023/5/78635_0s.png)
解读MaxPooling1D和GlobalMaxPooling1D的区别
2023-07-21 10:54:43
![](https://img.aspxhome.com/file/2023/3/97243_0s.png)
Python实现定时任务的八种方案详解
2022-04-19 06:54:03
![](https://img.aspxhome.com/file/2023/5/130765_0s.jpg)
Python简单网络编程示例【客户端与服务端】
2023-12-07 10:26:55
Python真题案例之小学算术 阶乘精确值 孪生素数 6174问题详解
2022-12-02 11:09:33
![](https://img.aspxhome.com/file/2023/6/86626_0s.png)
Golang的关键字defer的使用方法
2023-07-12 21:10:49
![](https://img.aspxhome.com/file/2023/1/95351_0s.png)
python实战游戏之史上最难最虐的扫雷游戏没有之一
2021-03-08 04:43:03
![](https://img.aspxhome.com/file/2023/8/66748_0s.gif)
pytorch collate_fn的基础与应用教程
2021-06-03 02:55:57
![](https://img.aspxhome.com/file/2023/2/103492_0s.png)
XMLHttp ASP远程获取网页内容代码
2011-04-10 10:41:00