Hi everybody, I search this question and don't see any solutions... I don't believe this problem in Struts2 is so difficult:
1) I've an Interceptor where I search an url to go from Database.
2) I've an possible Action (if neccesary) where catch this url that Interceptor search.
Solutions at the moment (no one works)
SOLUTION A)
INTERCEPTOR CODE:
invocation.getStack().setValue("#attr['opcionMenuDirecta']", unica.getUrl());
//OR USE: invocation.getInvocationContext().getParameters().put("directUrl", database.getUrl());
return BaseAction.SUCCESS;
STRUTS.XML CODE:
<result name="success" type="redirectAction">${directUrl}</result>
SOLUTION B)
I can use the action for a alternative solution to my problem, but I can't passing a value from interceptor to the action. I attempt:
INTERCEPTOR CODE:
HttpServletRequest request = (HttpServletRequest)invocation.getInvocationContext().get(HTTP_REQUEST);
request.setAttribute("directUrl", database.getUrl());
//OR USE: invocation.getInvocationContext().getParameters().put("directUrl", database.getUrl());
return BaseAction.SUCCESS;
STRUTS.XML CODE:
<result name="success" type="redirectAction">Action_1?directUrl=${directUrl}</result>
<!-- OR result name="success" type="redirectAction">Action_1</result -->
ACTION_1 CODE:
this.request.getAttribute("directUrl")
THIS SOLUTION, WITH THE STRUTS.XML IN "CHAIN" MODE:
<result name="success" type="chain">Action_1</result>
WORKS, BUT I DON'T WANT TO USE THE CHAIN OPTION.
any solution else?
Thanks in advance
any solution
Thanks in advance