On 1/11/2018 11:13 AM, [email protected] wrote:
> My question is originally posted here:
> https://stackoverflow.com/questions/48166761/struts-2-multiple-configuration-files-and-global-results-for-different-namespace
>
> But it is incorrectly marked as duplicate. Due to less formatting options,
> I'll be brief.
> I'm migrating a big struts1 application to struts2. Basically, I have a
> package in config file A with namespace="/" and some global-results. I want
> to access those global-results with config file A package namespace="/" in
> other config file X with package namespace="/Xname".
>
> My current solution extends config file A package in config file X package. I
> want to access global result jsp at the url: /common/global-test.jsp as a
> result forwarded from config file X action class.
> However, it is incorrectly adding config file X package namespace in fetching
> the jsp file as /Xname/common/global-test.jsp.
>
> Any suggestions?
Do you have a slash (/) at beginning of your result value? I get same
error like you when I don't haven that slash but works with a starting
slash. My working example:
<package name="default" namespace="/" extends="struts-default">
<global-results>
<result
name="globalResult1">/WEB-INF/content/hello.jsp</result><!--
starts with slash -->
</global-results>
...
...
<package name="commerce" extends="default" namespace="/commerce">
<action name="knobhead"
class="me.zamani.yasser.ww_convention.actions.CategoriesAction">
<result name="success"
type="tiles">commerce.categories</result>
</action>
</struts>
...
package me.zamani.yasser.ww_convention.actions;
public class CategoriesAction {
public String execute()
{
return "globalResult1";
}
}