Multiple configuration files and incorrect global-results for different namespaces

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple configuration files and incorrect global-results for different namespaces

sim4biz@gmail.com
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?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple configuration files and incorrect global-results for different namespaces

Yasser Zamani-2


On 1/11/2018 11:13 AM, [hidden email] 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";
     }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Multiple configuration files and incorrect global-results for different namespaces

shahzad.ismail@gmail.com


On 2018-01-12 23:26, Yasser Zamani <[hidden email]> wrote:

>
>
> On 1/11/2018 11:13 AM, [hidden email] 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";
>      }
> }
>

Yes, that was the problem. Huge thanks, Yasser!!!
I prepended a '/' for the global-result and it worked.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]