Right, but I'm wondering what happens if 2 packages have the SAME namespace and 
each have an action with the same name like:

<package name="testPrivatePages" extends="private" namespace="/test">
        <action name="testAction"> etc.

<package name="testPublicPages" extends="public" namespace="/test">
        <action name="testAction"> etc.

Which one gets selected?

-Tim

Martin Gainty wrote:
extends attribute:
The extends attribute is optional and allows one package to inherit the configuration of one or more previous packages - including all interceptor, interceptor-stack, and action configurations.
http://struts.apache.org/2.0.14/docs/package-configuration.html
but a package can be abstract which means NO action available so dont use package for assigning action

namespace attribute:
The namespace attribute subdivides action configurations into logical modules, each with its own identifying prefix. Namespaces avoid conflicts between action names. Each namespace can have its own "menu" or "help" action, each with its own implementation. While the prefix appears in the browser URI, the tags are "namespace aware", so the namespace prefix does not need to be embedded in forms and links.
http://struts.apache.org/2.0.14/docs/namespace-configuration.html

if a request for /barspace/bar.action is made then namespace barspace is searched for bar action this addresses your requirement for same action name but using differing namespace

HTH
Martin
______________________________________________
Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

This message is confidential. If you should not be the intended receiver, then 
we ask politely to report. Each unauthorized forwarding or manufacturing of a 
copy is inadmissible. This message serves only for the exchange of information 
and has no legal binding effect. Due to the easy manipulation of emails we 
cannot take responsibility over the the contents.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.






 > Date: Thu, 7 May 2009 11:26:07 -0400
 > From: to...@genome.med.harvard.edu
 > To: user@struts.apache.org
 > Subject: Struts 2 Namespaces
 >
 > Hello All,
 >
> I just have a quick question concerning struts 2 namespaces. Mainly, are they unique?
 >
> I have a book "Practical Apache Struts 2 Web 2.0 Projects" which states that:
 >
> "The name attribute as well as the namespace attribute must be unique. If not Struts 2 will not startup correctly.".
 >
> Which seems like the straight answer to my question, but upon trying this I found it to not be true. I am able to define 2 packages with the same namespace ala:
 >
 > <package name="testPrivatePages" extends="private" namespace="/test">
 >
 > <package name="testPublicPages" extends="public" namespace="/test">
 >
> And all actions in both these packages work correctly. So am I setting myself up for disaster here, or is this a acceptable declaration? If it's ok, then is there some rule as to how Struts 2 will > differentiate between 2 actions with the same name, but in different packages?
 >
 > Thanks,
 > Tim
 >
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 > For additional commands, e-mail: user-h...@struts.apache.org
 >

------------------------------------------------------------------------
Hotmail® has a new way to see what's up with your friends. Check it out. <http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009>

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

Reply via email to