Trying to set the right URL - Struts 2

584 views Asked by At

I have a Struts2 app and I'm having a bit of a problem:

at the first page (index.jsp) I have a javascript line that sets the url to './admin/Search' like this:

window.location='./admin/Search';

that sends me to the login page and if I have access it will redirect me directly to the mentioned page. The problem is that, after that, all my actions keep this first namespace '/admin'. Other actions just do not have this '/admin' namespace, for example, they could have a '/users' namespace. In this cases the server can't locate the right action because it will look for /admin/myAction in the struts.xml file. It's like struts 2 doesn't change the whole namespace/action. It just replaces the action and that's it. I really need help on this guys! Thanks.

1

There are 1 answers

0
Jay Patel - PayPal On

You need to change the package namespace specified in the in struts.xml files. That will help you redirect your namespace inside your application.