Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 Namespaces

 
Jeff Shelley
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Alaa Nassef
Ranch Hand
Posts: 471
Hibernate Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic