commandButton のメソッド アクションを介して、オブジェクト (モデル マネージド Bean のインスタンス) を jsf ビューからコントローラー マネージド Bean に渡そうとしています。しかし、転送されたオブジェクトがコントローラーのマネージド Bean で null であることがわかったため、問題のサービスをこの方法で実行することはできません。ビューの関係する部分は次のとおりです。
<h:commandLink action="#{employee.delete}" value="Delete account">
<f:setPropertyActionListener target="#{empolyee.emp}" value="#{emp}" />
</h:commandLink>
そして、ここでは、コントローラー管理対象 Bean の一部:
@ManagedBean(name="employee")
@RequestScoped
public class EmployeeController implements Serializable {
private Employee emp = new Employee();
public Employee getEmp() {
return emp;
}
public void setEmp(Employee emp) {
this.emp= emp;
}
public String delete(){
if (this.emp == null) {return "bad";} // The execution stopped here, and the outcome corresponded is returned
else {
employImp.deleteAccount(this.emp);
return "good";
}
}
プロセス後にオブジェクトが null になったのはなぜですか? ありがとう。