[S2 Tip] Use namespaces to organize your application into logical modules

2007-03-23 Thread Ted Husted

Many Struts applications contain hundreds of pages. To help organize
large applications, the Struts configuration is designed around the
notions of packages and namespaces. Each package can set its own
defaults, including a namespace setting.

struts
   package name=example namespace=/example extends=struts-default

   action name=HelloWorld class=example.HelloWorld
   result/example/HelloWorld.jsp/result
   /action

   !-- Add actions here --
   /package
/struts

Use the namespace attribute to create logical modules or units of work
within an application, each with its own identifying prefix. In an
accounting application, the actions relating to payables might be in
one namespace, and actions relating to receivables in another.

Namespaces avoid conflicts between action names. Each namespace can
have it's 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.

-HTH, Ted
http://www.husted.com/ted/blog/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2 Tip] Use namespaces to organize your application into logical modules

2007-03-23 Thread Harring Figueiredo

Ted,

Thank you so much for sending this out. I was wandering what was the
difference between namespace and package. I guess this explain well.

Thanks !

hff

On 3/23/07, Ted Husted [EMAIL PROTECTED] wrote:


Many Struts applications contain hundreds of pages. To help organize
large applications, the Struts configuration is designed around the
notions of packages and namespaces. Each package can set its own
defaults, including a namespace setting.

struts
package name=example namespace=/example extends=struts-default

action name=HelloWorld class=example.HelloWorld
result/example/HelloWorld.jsp/result
/action

!-- Add actions here --
/package
/struts

Use the namespace attribute to create logical modules or units of work
within an application, each with its own identifying prefix. In an
accounting application, the actions relating to payables might be in
one namespace, and actions relating to receivables in another.

Namespaces avoid conflicts between action names. Each namespace can
have it's 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.

-HTH, Ted
http://www.husted.com/ted/blog/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: [S2 Tip] Use namespaces to organize your application into logical modules

2007-03-23 Thread Vinny

yes, little tips like this are appreciated.

On 3/23/07, Harring Figueiredo [EMAIL PROTECTED] wrote:


Ted,

Thank you so much for sending this out. I was wandering what was the
difference between namespace and package. I guess this explain well.

Thanks !

hff

On 3/23/07, Ted Husted [EMAIL PROTECTED] wrote:

 Many Struts applications contain hundreds of pages. To help organize
 large applications, the Struts configuration is designed around the
 notions of packages and namespaces. Each package can set its own
 defaults, including a namespace setting.

 struts
 package name=example namespace=/example
extends=struts-default

 action name=HelloWorld class=example.HelloWorld
 result/example/HelloWorld.jsp/result
 /action

 !-- Add actions here --
 /package
 /struts

 Use the namespace attribute to create logical modules or units of work
 within an application, each with its own identifying prefix. In an
 accounting application, the actions relating to payables might be in
 one namespace, and actions relating to receivables in another.

 Namespaces avoid conflicts between action names. Each namespace can
 have it's 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.

 -HTH, Ted
 http://www.husted.com/ted/blog/

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]







--
Ghetto Java: http://www.ghettojava.com


Re: [S2 Tip] Use namespaces to organize your application into logical modules

2007-03-23 Thread Piero Sartini
Thank you Ted,

like Harring I also wondered what namespaces are all about and decided they 
arent that important to me - however, already tried to make action names 
like foo/bar. Now I consider namespaces very useful.

Maybe this should be included in the wiki somewhere. (Tips  Tricks Corner?)

I would love to see more such posts :-)

Piero

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]