SAStrutsで同一メソッドにてリダイレクトとフォワードを使い分ける
SAStrutsにて同一メソッドの処理結果でリダイレクトとフォワードを使い分けたい場合がある時の記述。
通常のリダイレクト
@Execute(validator = false, redirect = true) public String edit() { return "edit.html"; }
クエリストリングにパラメータとして付与
以下の逆で、@Execute内のredirectをtrueにし、クエリストリングのredirectをfalseに渡すパターンはNGみたい。
@Execute(input = "edit.html", redirect = false) public String update() { try { customerService.update(entity); } catch (SOptimisticLockException e) { setMessages("errors.versionNo", null); return "edit.html"; } return "/customer/?redirect=true"; }