私は(ここにある)CustomerAction.java
の下にある という名前のStruts 2アクションを持っています。このアクション クラス内のメソッドの 1 つから、レガシー アクション クラスにリダイレクトしていますfolderHierarchy/actions/customer
customer
namespace
Result
マッピングは次のとおりです。
@Result(name = "redirectTo", location = "#parameters.redirectLocation", type = "redirect") })
の値#parameters.redirectLocation
は
/customerhome.do?custIdId=200
Action
方法は:
@Action(value = "CustomerAction!redirectToPage")
public String redirectToLocation() {
return "redirectTo";
}
customer
しかし問題は、リダイレクトの場所の前に現在のアクション名前空間 (つまり ) を自動的に追加するストラットです。
したがって、リダイレクトする代わりに
/myWebApp/customerhome.do?custIdId=200
、
Struts 2はにリダイレクトしています
/myWebApp/customer/customerhome.do?custIdId=200
名前空間を追加する理由とcustomer
、これを取り除く方法がわかりませんか?
私も試しました:
@Result(name = "redirectTo", location = "#parameters.redirectTo", type = "redirect", params = { "namespace", "/" }) })
しかし、それもうまくいきませんでした。
別の観察結果は次のとおりです。
何が機能するか:
@Result(name = ComposeMessageCrudAction.REDIRECT_TO, location = "/customerhome.do?custIdId=200", type = "redirect") })
何が機能しないか:
@Result(name = "redirectTo", location = "#parameters.redirectLocation", type = "redirect") })
の値#parameters.redirectLocation
は
/customerhome.do?custIdId=200
2番目のアプローチが機能しない理由と、customer
前に名前空間を追加する理由がわかりません
/customerhome.do?custIdId=200