RE: Multiple modules - Please help
It wouldn't be (easily) possible to change ForwardAction to be configurable between context and module relative because the ActionMapping only has one parameter which is already being used to provide the path. A couple of options would be to create a second version of ForwardAction (ModuleForwardAction ?) that returns a module relative ActionForward, or to create a simple action that returns an ActionForward which is configured in struts-config with a well-known name (success, in my example). I prefer the latter approach because it is more flexible and uses the standard method of configuring the ActionForward via struts-config. You'd have to create your own for now, but I hope to add this as a standard action. The action (SuccessAction): public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return mapping.findForward(success); } struts-config.xml: !-- Module relative mapping -- action path=/showEdit type=com.ninsky.struts.actions.SuccessAction forward name=success path=/edit.jsp/ /action -or- !-- Context relative mapping -- action path=/showEdit type=com.ninsky.struts.actions.SuccessAction forward name=success path=/admin/edit.jsp contextRelative=true/ /action Steve -Original Message- From: Ajay Patil [mailto:[EMAIL PROTECTED] Sent: July 29, 2003 7:11 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Multiple modules - Please help Dear Steve, Thanks for finding the problem in the configuration file. I had not realized it. ** sorry for the typo in bug report ** So, now I have an enhancement request.. :) Would it be possible to enhance ForwardAction so that it also requires a MODULE relative path ? It would be then very intuitive and convenient. Also, splitting into modules will be easier as you simply have to chop off the module path globally. Changing module names will be even easier. If you think the above is ok and it doesnt conflict with the current implementation, I shall re-open the bug as an enhancement request. Please let me know, Thanks a bunch, Ajay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Subject RE: Multiple modules - Please help
Ajay, I've closed this bug. It seems to be a configuration problem... I'm assuming that your add.jsp and edit.jsp files are in the /admin directory. The problem is with your configuration. ForwardAction requires a CONTEXT relative path which, in this case would be: action path=/showEdit type=org.apache.struts.actions.ForwardAction parameter=/admin/edit.jsp /action (Note also, you had your parameter in a separate tag, but it should be an attribute of the action tag. Not sure if that's what you actually had in your source or it's just a typo in the bug report, but it wouldn't help!) The reason it worked when you used your own custom action is that by default ActionFoward paths are MODULE relative, so your configuration entry /edit.jsp would be translated by the RequestProcessor to a context relative path of /admin/edit.jsp ... if you still have problems after this, please post back to the user list. Steve -Original Message- From: Steve Raeburn [mailto:[EMAIL PROTECTED] Sent: July 28, 2003 9:13 PM To: Struts Users Mailing List Subject: RE: Subject RE: Multiple modules - Please help Glad you got it working. I'll take a look at your bug report and see if I can sort out what's happening with ForwardAction. Steve -Original Message- From: Ajay Patil [mailto:[EMAIL PROTECTED] Sent: July 28, 2003 8:28 PM To: [EMAIL PROTECTED] Subject: Subject RE: Multiple modules - Please help Dear Steve, Can you access the edit or remove actions by entering the URL in your address bar? e.g. http://localhost:8080/myapp/admin/edit.do?parameter=XXX Your tip helped me to debug the problem. Apparently, I got the 404 error from the browser. In the config file, edit.do was declared to be of type ForwardAction. I created a new action class and used it instead of ForwardAction. and voila, it worked ! So, it might be a bug in ForwardAction. I have posted a bug at http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21949 Thanks, Ajay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multiple modules - Please help
Dear Steve, Thanks for finding the problem in the configuration file. I had not realized it. ** sorry for the typo in bug report ** So, now I have an enhancement request.. :) Would it be possible to enhance ForwardAction so that it also requires a MODULE relative path ? It would be then very intuitive and convenient. Also, splitting into modules will be easier as you simply have to chop off the module path globally. Changing module names will be even easier. If you think the above is ok and it doesnt conflict with the current implementation, I shall re-open the bug as an enhancement request. Please let me know, Thanks a bunch, Ajay Ajay, I've closed this bug. It seems to be a configuration problem... I'm assuming that your add.jsp and edit.jsp files are in the /admin directory. The problem is with your configuration. ForwardAction requires a CONTEXT relative path which, in this case would be: action path=/showEdit type=org.apache.struts.actions.ForwardAction parameter=/admin/edit.jsp /action (Note also, you had your parameter in a separate tag, but it should be an attribute of the action tag. Not sure if that's what you actually had in your source or it's just a typo in the bug report, but it wouldn't help!) The reason it worked when you used your own custom action is that by default ActionFoward paths are MODULE relative, so your configuration entry /edit.jsp would be translated by the RequestProcessor to a context relative path of /admin/edit.jsp ... if you still have problems after this, please post back to the user list. Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multiple modules - Please help
Hello, Thanks for the lightning response ! Actually, I am not switching modules. I am trying to forward to another action in the same module. I still get the 404 error with the contextRelative attribute in forward definition. Inside web.xml: --- init-param param-nameconfig/admin/param-name param-value/WEB-INF/struts-admin.xml/param-value /init-param Inside struts-admin.xml --- action path=/list type=xxx.yyy.zzz.ListAction forward name=addpath=/add.jsp!-- THIS WORKS OK -- forward name=edit path=/edit.do!-- 404 ERROR -- forward name=remove path=/remove.do !-- 404 ERROR -- /action action path=/edit type=xxx.yyy.zzz.EditAction forward name=edit path=/edit.jsp /action action path=/remove type=xxx.yyy.zzz.RemoveAction forward name=edit path=/remove.jsp /action It was working when I had a single configuration file. I created struts-admin.xml file and removed the admin (module name) prefix from all paths. Now the JSP forwards are working. But the action-chainings give me 404 errors. Thanks for patiently reading through my problem. Ajay If the action you are forwarding to is in a different module then you need to use the SwitchAction or specify contextRelative=true on your forward definition. forward name=edit path=/modulename/edit.do contextRelative=true Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multiple modules - Please help
Can you access the edit or remove actions by entering the URL in your address bar? e.g. http://localhost:8080/myapp/admin/edit.do?parameter=XXX Steve -Original Message- From: Ajay Patil [mailto:[EMAIL PROTECTED] Sent: July 27, 2003 11:21 PM To: [EMAIL PROTECTED] Subject: RE: Multiple modules - Please help Hello, Thanks for the lightning response ! Actually, I am not switching modules. I am trying to forward to another action in the same module. I still get the 404 error with the contextRelative attribute in forward definition. Inside web.xml: --- init-param param-nameconfig/admin/param-name param-value/WEB-INF/struts-admin.xml/param-value /init-param Inside struts-admin.xml --- action path=/list type=xxx.yyy.zzz.ListAction forward name=addpath=/add.jsp!-- THIS WORKS OK -- forward name=edit path=/edit.do!-- 404 ERROR -- forward name=remove path=/remove.do !-- 404 ERROR -- /action action path=/edit type=xxx.yyy.zzz.EditAction forward name=edit path=/edit.jsp /action action path=/remove type=xxx.yyy.zzz.RemoveAction forward name=edit path=/remove.jsp /action It was working when I had a single configuration file. I created struts-admin.xml file and removed the admin (module name) prefix from all paths. Now the JSP forwards are working. But the action-chainings give me 404 errors. Thanks for patiently reading through my problem. Ajay If the action you are forwarding to is in a different module then you need to use the SwitchAction or specify contextRelative=true on your forward definition. forward name=edit path=/modulename/edit.do contextRelative=true Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Subject RE: Multiple modules - Please help
Dear Steve, Can you access the edit or remove actions by entering the URL in your address bar? e.g. http://localhost:8080/myapp/admin/edit.do?parameter=XXX Your tip helped me to debug the problem. Apparently, I got the 404 error from the browser. In the config file, edit.do was declared to be of type ForwardAction. I created a new action class and used it instead of ForwardAction. and voila, it worked ! So, it might be a bug in ForwardAction. I have posted a bug at http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21949 Thanks, Ajay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Subject RE: Multiple modules - Please help
Glad you got it working. I'll take a look at your bug report and see if I can sort out what's happening with ForwardAction. Steve -Original Message- From: Ajay Patil [mailto:[EMAIL PROTECTED] Sent: July 28, 2003 8:28 PM To: [EMAIL PROTECTED] Subject: Subject RE: Multiple modules - Please help Dear Steve, Can you access the edit or remove actions by entering the URL in your address bar? e.g. http://localhost:8080/myapp/admin/edit.do?parameter=XXX Your tip helped me to debug the problem. Apparently, I got the 404 error from the browser. In the config file, edit.do was declared to be of type ForwardAction. I created a new action class and used it instead of ForwardAction. and voila, it worked ! So, it might be a bug in ForwardAction. I have posted a bug at http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21949 Thanks, Ajay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple modules - Please help
hi, there is an SwitchAction available with struts, which can be used to switch bet' modules. try it i have't implemented though -- nagi ---Original Message--- From: Struts Users Mailing List Date: Monday, July 28, 2003 10:47:39 AM To: [EMAIL PROTECTED] Subject: Multiple modules - Please help Hello,I am trying to configure Struts with multiple modules. I have got most of it working but I am stuck up at one point. When the action classes forward to a JSP page, everything works ok.But I get a 404 error if the action forwards to another action.action path="/list".forward name="edit" path="/edit.do"/actionHas anyone got the above case working with multiple modules ?If yes, could you please send me the sample working config file ?I also tried giving the modulename prefix but I got a 400 error :-(action path="/list".forward name="edit" path="/modulename/edit.do"/actionAny help is a blessing.Ajay-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]. IncrediMail - Email has finally evolved - Click Here
RE: Multiple modules - Please help
If the action you are forwarding to is in a different module then you need to use the SwitchAction or specify contextRelative=true on your forward definition. forward name=edit path=/modulename/edit.do contextRelative=true Steve -Original Message- From: Ajay Patil [mailto:[EMAIL PROTECTED] Sent: July 27, 2003 10:30 PM To: [EMAIL PROTECTED] Subject: Multiple modules - Please help Hello, I am trying to configure Struts with multiple modules. I have got most of it working but I am stuck up at one point. When the action classes forward to a JSP page, everything works ok. But I get a 404 error if the action forwards to another action. action path=/list . forward name=edit path=/edit.do /action Has anyone got the above case working with multiple modules ? If yes, could you please send me the sample working config file ? I also tried giving the modulename prefix but I got a 400 error :-( action path=/list . forward name=edit path=/modulename/edit.do /action Any help is a blessing. Ajay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]