当前位置: 编程技术>java/j2ee
JSP JavaBean的setProperty属性
来源: 互联网 发布时间:2014-10-17
本文导语: 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代码: 代码如下: JSP Page Original Color:...
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代码:
JSP Page
Original Color:
Changed Color:
3.输出:
Original Color: red
Changed Color: blue
代码如下:
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代码:
代码如下:
JSP Page
Original Color:
Changed Color:
3.输出:
Original Color: red
Changed Color: blue