struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "shahzad.ismail@gmail.com"<shahzad.ism...@gmail.com>
Subject Re: Multiple configuration files and incorrect global-results for different namespaces
Date Wed, 17 Jan 2018 08:29:52 GMT


On 2018-01-12 23:26, Yasser Zamani <yasserzamani@apache.org> wrote: 
> 
> 
> On 1/11/2018 11:13 AM, sim4biz@gmail.com 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message