wood burning stoves
The moose likes Struts and the fly likes Call an action defined within another package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Call an action defined within another package" Watch "Call an action defined within another package" New topic

Call an action defined within another package

John Louis

Joined: Aug 14, 2008
Posts: 10
I need to call an action defined in struts.xml within another package (one that is different from the package under which the currently executed action is in). I am now inside the jsp page directed to from action1 inside package1. From this jsp page I set the action url to "action2" but this action 2 is in package 2. When I submit the form I get a message which says /package1/action2 not defined.

Can some1 help me out with this?
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
I haven't done what your trying to do before but I think your problem is that when are calling action2 you are specifying the name space for package1. I think if you direct you url to the namespace specified for package2 this will work.

Displaying the relevand parts of your jsp and struts.xml file as well as the error message might help.
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 689


In struts2 you can use "namespace" for call another package action and also get new URL type.

So use namespace.

Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
I agree. Here's the link: http://aspose.com/file-tools
subject: Call an action defined within another package
jQuery in Action, 3rd edition