ı have a problem about jsf 2.0
managedbeans. the problem is that, ı create two objects in my managedbean and when ı set the data of one of them the other changes. the following code show the problem,
@ManagedBean(name = "mainn")
@ViewScoped
public class Mainn {
private AyniAndaDoğrusalIkiliHareket one = new AyniAndaDoğrusalIkiliHareket();
private AyniAndaDoğrusalIkiliHareket two = new AyniAndaDoğrusalIkiliHareket();
public void Hesapla() {
one.setX2(5);
System.out.println(two.getX2()); // printf 5 the value of "one"
}
}
How can ı solve it ?
在AyniAndaDoğrusalIkiliHareket
声明您的x2
成员不是 static
的。
JSF 2 : ViewScoped Problem, bean not persisted when redisplaying the same page
maybe that post same as with your problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.