This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to invoke default and root namespaces?

 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my namespace file


if i put http://localhost:8080/My/abc/Struts2HelloWorld.action it goes to first namespace.
How to invoke 2 nd and 3 rd namespaces?
 
Mark E Hansen
Ranch Hand
Posts: 650
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actions in a package with the default namespace will be considered only if the requested action is not found in a package with a namespace matching that of the request (didn't we already cover this? - see http://www.coderanch.com/t/485083/Struts/Application-Frameworks/are-these-both-root-tags).

In your case, mypackage3 uses the default namespace. What would happen if you browsed to http://localhost:8080/My/foobar/moo
Do you have a package which matches the namespace foobar? If not, then the framework will search the packages which use the default namespace (mypackage3 in your case).

Does that answer your question?
 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then when is to invok namespace="/" ?
 
Mark E Hansen
Ranch Hand
Posts: 650
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samanthi perera wrote:then when is to invok namespace="/" ?

I'm sorry, I'm not sure I can understand your English.
http://localhost:8080/My/moo would match the action in mypackage2
http://localhost:8080/My/foo/moo would not match the action in mypackage2 because the request references a namespace of foo

I think you're not seeing the difference between the / namespace and the default namespace. They are different. See the discussion we had on the previous thread (referenced above).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic