When I set a context-root
in weblogic.xml
for my application, what is the default namespace for package in Struts 2?
ex: I set
<context-root>/home/app/exec</context-root>
and I access my app with the following URI:
localhost:8081/home/app/exec/index.html
insted of
localhost:8081/NameOfMyApp/index.html
In the other hand I Know that in Struts2 action namespace map to folder structure. Example on the following link: Struts 2 Namespace configuration example and explanation.
What is the correct namespace for the situation in case that ServletContext
is not the name of my app but is the context-root
?
Namespace is the part that is calculated after the context path and before the action name. On the other hand a namespace is an attribute of the package that holds the actions belonging that namespace. A default action mapper is using both attributes to find the action config corresponding the namespace and action name.
For detailed explanation of default action mapper you can read javadocs DefaultActionMapper.
You can read more about action configuration and ActionMapper on the Struts docs site.
You should also know that the action mapper returns ActionMapping. However, to execute an action requires ActionConfig which is determined by the Struts using run-time configuration.