0

サーベットやフィルターを使用せずに、単一の Bean によって制御されるグループ ページへの直接アクセスを (特定の状況下で) 無効にするにはどうすればよいですか? 今、私はこのようなものを持っています:

   public SomeBeanController() {
    try {
      FacesContext.getCurrentInstance().getExternalContext().redirect("/somewhere.xhtml");
    } catch (Exception e) {
      e.printStackTrace();
    }
    throw new IllegalArgumentException("Direct access is disabled...");
   }

   public SomeBeanController(Integer someId) {
     this.someId = someId;
   }

デフォルトの Bean コンストラクターは、より適切なページにリダイレクトします。他のコンストラクターは、ページのグループにアクセスする必要がある場合にのみ、別の Bean から呼び出されます。

ありがとう!

4

0 に答える 0