This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

basic struts2 question

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
in a struts2 struts.xml file, we define a package:
<package name="example" namespace="/example" extends="struts-default">
where is this package definition used? and the namespace?
Reason i ask is, if i change the namespace to something else, say, namespace="vvm", the example throws a "resource not found" exception.
Thanks,
Nilesh
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Namespace is URI prefix for the resource you are requesting.

See below links for details
1. http://struts.apache.org/2.0.12/docs/namespace-configuration.html
2. http://struts.apache.org/2.0.12/docs/package-configuration.html
 
Nilesh Thali
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I did read that part.
What was confusing me was that if i changed the package namespace to /vvm and then requested the url vvm/vvm.action
it threw an error: "there is no namespace /". i can't tell if it's getting confused because my java src package is also vvm.
Thanks,
Nilesh
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts didn't reach to you action yet. It couldn't resolve the URL "vvm/vvm.action". Are you sure you have "vvm" action within "vvm" package? May be you need to post the struts.xml
 
Nilesh Thali
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the relevant part of my struts.xml:

and here's what index.html was doing:


whereupon, i get the following error:
There is no Action mapped for namespace / and action name VVMAction

now, changing the package namespace to anything else like "/junk" and updating index.html appropriately works.
which is why my suspicion is that the name clash of vvm for namespace and for the package is causing this problem.

anyways, it works now, but just wanted to provide you with a clearer picture, and see what you thought.
Thanks for your help.
Nilesh
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic