Reputation: 1
Now I have the
<result name="success">WEB-INF/account/ad_tools.jsp</result>
which I want to replace the WEB-INF/account
with something like this {basePath}
, I can get
<resutl name="success">{basePath}/account/ad_tools.jsp</result>
I still can change the variable basePath
when I need to.
Where should I put the variable basePath
and How I can do it?
Or If you have another way to handle my question?
Upvotes: 0
Views: 179
Reputation: 1
The simple way is to put this variable basePath
to the value stack. You can do it in many ways. For example
ActionContext.getContext().getValueStack().set("basePath", "/WEB-INF/account");
The result attributes are parsed by default, so you can use it in the result declaration.
<result name="success">${basePath}/ad_tools.jsp</result>
Another way is to use convention plugin where you can define a constant
<constant name="struts.convention.result.path" value="/WEB-INF/account/"/>
and use annotation to override the convention configuration
@Result(name="success", location="ad_tools.jsp")
Upvotes: 0