This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 2 Namespaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 Namespaces" Watch "Struts 2 Namespaces" New topic
Author

Struts 2 Namespaces

Jeff Shelley
Ranch Hand

Joined: May 21, 2003
Posts: 70
Hello and thanks in advance for considering my question.

The concept of namespaces in struts seems pretty nice as far as logically separating groups of urls/action mappings, but it leaves me with a couple questions:

1.) I noticed that if I don't begin a context with a "/" (in the <s:url> tag), it will ADD this namespace to my url. So if I'm in the result page from http://localhost:8080/webapp/ns1/abc.action, and do <s:url action="Yo" namespace="hi"... that will give me a url of http://localhost:8080/webapp/ns1/hi/Yo.action. Is there any practical application to these nested links, or should I just always remember the slash?

2.) I'm also mapping my ajax calls in my struts.xml. Is there any word on putting these in their own namespace, or is that overkill?

Thanks very much. I look forward to reading your book.
--Jeff Shelley


It's almost Friday
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 460
As for your first question, I guess that you have to always remember the slash, since some people would like to include a name space withing another one. Of course you can extend the tag library to override this (that's the beauty of open source).

As for the second question, why don't you put the ajax calls in a separate XML file and include it in struts.xml?


Visit my blog: http://jnassef.blogspot.com/
 
 
subject: Struts 2 Namespaces
 
Similar Threads
struts application not using *.do
webapp not on 8080 and html:base
Struts url problem
URL mapping
ravula62020