• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Struts 2 Namespaces

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
reply
    Bookmark Topic Watch Topic
  • New Topic