You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by st...@hullegard.com on 2007/08/12 14:10:44 UTC

Global forward with parameters in struts-config.xml?

Hi,

Is it possible to define parameters that should be sent to a global forward in
struts-config.xml? Ie I want it all configured in the struts-config.xml.

Example:

  <global-forwards>
     <forward   name="not-logged-in"   path="/?action=login" />
  </global-forwards>

I cannot add the parameters before the forward is "called", because it is done
in 3rd party classes that I don't want to mess with.

I guess one option could be to write my own action class or something, that adds
the required parameter, but I would very much like to be able to do this only
using struts-config.xml.

Regards
/Jimi

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Url-mapping *.do not working (Was: Global forward with parametersin struts-config.xml?)

Posted by st...@hullegard.com.
ah, great. I totally forgot that there actually is *two* url mappings 
being done
(first the *.do -> struts and the actuall mapping for the action).

Now I have path="**/logoff", since I want it to work no matter what 
subdirectory
the user is under.

Thanks a lot, Oliver!

/Jimi

Quoting KrustyDerClown <Kr...@gmx.de>:

> I think you must check your struts-config.xml
>
> The path in the action mapping must be user-area/logoff.do
>
> Then it should work.
>
> Greets Oliver
>
>
>
> ----- Original Message ----- From: <st...@hullegard.com>
> To: <us...@struts.apache.org>
> Sent: Sunday, August 12, 2007 3:06 PM
> Subject: Url-mapping *.do not working (Was: Global forward with 
> parametersin struts-config.xml?)
>
>
>> Quoting struts@hullegard.com:
>>
>>> Hi,
>>>
>>> Is it possible to define parameters that should be sent to a global 
>>> forward in
>>> struts-config.xml? Ie I want it all configured in the struts-config.xml.
>>>
>>> Example:
>>>
>>>  <global-forwards>
>>>     <forward   name="not-logged-in"   path="/?action=login" />
>>>  </global-forwards>
>>>
>>> I cannot add the parameters before the forward is "called", because 
>>> it is done
>>> in 3rd party classes that I don't want to mess with.
>>>
>>> I guess one option could be to write my own action class or 
>>> something, that adds
>>> the required parameter, but I would very much like to be able to do 
>>> this only
>>> using struts-config.xml.
>>
>> I just realised that I needed to add redirect="true" for it to work.
>>
>> But now I face another problem. The "logoff.do" part of an url 
>> doesn't work in
>> "subfolders" of the webapp.
>>
>> For instance, this URL works:
>> http://the-site/ksml/logoff.do
>>
>> But this doesn't:
>> http://the-site/ksml/user-area/logoff.do
>>
>> I get "404 - Invalid path was requested" from tomcat.
>>
>> I know that the logoff action isn't called, because it would print a debug
>> message before doing anything.
>>
>> In web.xml I have no other servlet mapping that could overlap this URL.
>>
>> This is my web.xml:
>> http://pastebin.com/m59eac462
>>
>> And this is my struts-config.xml:
>> http://pastebin.com/m5ab67434
>>
>> Actually, I now noticed that this error happens with *all* my 
>> action-URL's. the
>> *.do url-mapping simply doesn't work in any subfolder of the webapp.
>>
>> Can someone see what I have done wrong?
>>
>> Regards
>> /Jimi
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Url-mapping *.do not working (Was: Global forward with parametersin struts-config.xml?)

Posted by KrustyDerClown <Kr...@gmx.de>.
I think you must check your struts-config.xml

The path in the action mapping must be user-area/logoff.do

Then it should work.

Greets Oliver



----- Original Message ----- 
From: <st...@hullegard.com>
To: <us...@struts.apache.org>
Sent: Sunday, August 12, 2007 3:06 PM
Subject: Url-mapping *.do not working (Was: Global forward with parametersin 
struts-config.xml?)


> Quoting struts@hullegard.com:
>
>> Hi,
>>
>> Is it possible to define parameters that should be sent to a global 
>> forward in
>> struts-config.xml? Ie I want it all configured in the struts-config.xml.
>>
>> Example:
>>
>>  <global-forwards>
>>     <forward   name="not-logged-in"   path="/?action=login" />
>>  </global-forwards>
>>
>> I cannot add the parameters before the forward is "called", because it is 
>> done
>> in 3rd party classes that I don't want to mess with.
>>
>> I guess one option could be to write my own action class or something, 
>> that adds
>> the required parameter, but I would very much like to be able to do this 
>> only
>> using struts-config.xml.
>
> I just realised that I needed to add redirect="true" for it to work.
>
> But now I face another problem. The "logoff.do" part of an url doesn't 
> work in
> "subfolders" of the webapp.
>
> For instance, this URL works:
> http://the-site/ksml/logoff.do
>
> But this doesn't:
> http://the-site/ksml/user-area/logoff.do
>
> I get "404 - Invalid path was requested" from tomcat.
>
> I know that the logoff action isn't called, because it would print a debug
> message before doing anything.
>
> In web.xml I have no other servlet mapping that could overlap this URL.
>
> This is my web.xml:
> http://pastebin.com/m59eac462
>
> And this is my struts-config.xml:
> http://pastebin.com/m5ab67434
>
> Actually, I now noticed that this error happens with *all* my 
> action-URL's. the
> *.do url-mapping simply doesn't work in any subfolder of the webapp.
>
> Can someone see what I have done wrong?
>
> Regards
> /Jimi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Url-mapping *.do not working (Was: Global forward with parameters in struts-config.xml?)

Posted by st...@hullegard.com.
Quoting struts@hullegard.com:

> Hi,
>
> Is it possible to define parameters that should be sent to a global 
> forward in
> struts-config.xml? Ie I want it all configured in the struts-config.xml.
>
> Example:
>
>  <global-forwards>
>     <forward   name="not-logged-in"   path="/?action=login" />
>  </global-forwards>
>
> I cannot add the parameters before the forward is "called", because 
> it is done
> in 3rd party classes that I don't want to mess with.
>
> I guess one option could be to write my own action class or 
> something, that adds
> the required parameter, but I would very much like to be able to do this only
> using struts-config.xml.

I just realised that I needed to add redirect="true" for it to work.

But now I face another problem. The "logoff.do" part of an url doesn't work in
"subfolders" of the webapp.

For instance, this URL works:
http://the-site/ksml/logoff.do

But this doesn't:
http://the-site/ksml/user-area/logoff.do

I get "404 - Invalid path was requested" from tomcat.

I know that the logoff action isn't called, because it would print a debug
message before doing anything.

In web.xml I have no other servlet mapping that could overlap this URL.

This is my web.xml:
http://pastebin.com/m59eac462

And this is my struts-config.xml:
http://pastebin.com/m5ab67434

Actually, I now noticed that this error happens with *all* my 
action-URL's. the
*.do url-mapping simply doesn't work in any subfolder of the webapp.

Can someone see what I have done wrong?

Regards
/Jimi

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org