Struts 2 Multiple Namespace Example
We can define multiple namespaces in struts.xml file by the namespace attribute of package element. As we know, default namespace is / (root).
Let's see the simple example to define multiple namespaces in struts.xml file.
Define multiple namespaces in struts.xml
This struts.xml file contains three packages with different names and namespaces.struts.xml
Other required resources
We need some other required files to understand the full example of multiple namespaces.
1) Create index.jsp
This jsp page provides three links.index.jsp
2) Create the action class
It is the simple action class containing execute method only.Welcome.java
3) 3 view components
Here name of all the 3 view components are same but there location are different.welcome.jsp
It must be located in the root directory.welcome.jsp
It must be located in the first directory under the root directory.welcome.jsp
It must be located in the second directory under the root directory.