刚刚开始学java,早年间听说过javabean这个技术,但是现在貌似不怎么提了。
我在oracle官网上看到这么一段话:JavaBeans technology is the component architecture for the Java 2 Platform, Standard Edition (J2SE). 我想问一下,现在javabean是不是过时了?现在版本的java se还支持么?
我现在在学习java的web编程,还用去看javabean么?
我在oracle官网上看到这么一段话:JavaBeans technology is the component architecture for the Java 2 Platform, Standard Edition (J2SE). 我想问一下,现在javabean是不是过时了?现在版本的java se还支持么?
我现在在学习java的web编程,还用去看javabean么?
import java.beans.PropertyChangeSupport;
import java.beans.PropertyChangeListener;
public class Person {
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private String name; public Person(){} public Person(String name){
this.name = name;
} public void setName(String name){
String old = this.name;
this.name = name;
pcs.firePropertyChange("name", old, this.name);
} public String getName(){
return this.name;
} public void addPropertyChangeListener(PropertyChangeListener l){
pcs.addPropertyChangeListener(l);
} public void removePropertyChangeListener(PropertyChangeListener l){
pcs.removePropertyChangeListener(l);
}
}