Re: multiple modules cannot retrieve mapping not fun!
Use this /author/loginAuthor.do in html-el:form HTH Manish Singla Matt Pease wrote: Hi all -- I'm trying to move to struts 1.1 multiple application modules am getting a very frustrating error that I can't seem to move around. I've searched the archives haven't found a solution. Bummer! When I try to access a very simple JSP (/author/login.jsp) with a html:form, Struts gives an error saying Cannot retrieve mapping for action /loginAuthor. What is strange though is that I can go to /author/loginAuthor.do struts finds the mapping then. It seems like the login.jsp page doesn't realize that it is in the author sub-application. How do I make the JSP know which sub-app it is part of? The documentation wasn't very clear on this (or at least I couldn't find it) The error, a description of my setup, important parts of various files are below. Has anyone seen this before? What am I doing wrong? Thanks very much- Matt http://localhost/together/author/login.jsp -- this gives: 500 Servlet Exception javax.servlet.jsp.JspException: Cannot retrieve mapping for action /loginAuthor at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:810) at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506) at org.apache.strutsel.taglib.html.ELFormTag.doStartTag(ELFormTag.java:324) at _author._login__jsp._jspService(/author/login.jsp:9) at com.caucho.jsp.JavaPage.service(JavaPage.java:75) at com.caucho.jsp.Page.pageservice(Page.java:553) etc. http://localhost/together/author/loginAuthor.do -- this works!! -- my setup I've set up my main web.xml file for multiple applications as instructed in the struts user guide. DTD refs in all the struts-config files are 1.1 versions. The webapp itself is under the /together context. App server is Caucho Resin. Struts is the latest 1.1 release. ---from web.xml servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value !-- just one mapping in here -- /init-param init-param param-nameconfig/author/param-name param-value/WEB-INF/struts-author-config.xml/param-value /init-param load-on-startup2/load-on-startup /servlet servlet-mapping url-pattern='*.do' servlet-name='action'/ --- from struts-author-config.xml --- action-mappings action path=/loginAuthor type=com.fullscreen.web.pubtool.author.LoginAuthorAction input=/login.jsp forward name=next path=/loadAuthorItems.do redirect=true/ /action /action-mappings - from uthor/login.jsp --- %@ page language=java % %@ taglib uri=http://jakarta.apache.org/struts/tags-html-el; prefix=html-el % html-el:html html-el:form action=/loginAuthor.do method=POST email address: input type=text name=email Password: input type=password name=password html-el:submit/ /html-el:form /html-el:html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thanks Manish Singla x73166 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple modules in a .EAR without code replication
We just finished a thread on this - see the thread named Struts across WARs ... http://www.mail-archive.com/[EMAIL PROTECTED]/msg86129.html [EMAIL PROTECTED] wrote: I am creating a STRUTS based app with .EAR as the deployable in which I want to host 2 .WARs, one for the internal user and the other for external user. I want to have exactly the same code base for both WARs including any resources and property/configuration files etc but for one Action class. Any suggestions how do I achieve this without replicating the code in both the .WARs Regards Sreekant G @ 98404-65630 This mail was scanned by Interscan Virus Wall of Mailserver2 at SNR, TCS, Chennai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple modules
What are the advantages of having multiple struts-config modules defined in web.xml vs comma separated struts-config.xml from design point of view. I am ok with slight overhead of multiple struts-config file (in web.xml approach). Again, what design problem multiple struts-config problem is solving. (Scalability and Separation of Concerns can be solved by comma separated struts-config.xml) Thanks - 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
On Thu, 18 Sep 2003, Manish Singla wrote: Date: Thu, 18 Sep 2003 20:51:59 -0600 From: Manish Singla [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Multiple modules What are the advantages of having multiple struts-config modules defined in web.xml vs comma separated struts-config.xml from design point of view. In my opinion, the largest single difference between the approaches is really namespace collisions. Consider what happens if two different struts-config.xml files (developed by two independent teams of developers working on portions of your overall application) both try to define an action named /foo, or a global forward named success: * If you are using a single module (one config file or multiple config files isn't relevant -- internally they are all combined into a single set of config entries), the last definition wins -- so someone's code doesn't work correctly unless the identifier is changed. * If you are using multiple modules, each module has its own namespace for actions, forwards, and so on -- so the fact that they share the same identifier doesn't matter. So, multiple modules gives you some protection against this problem, at the (slight) cost that it's a little funky to switch between modules. I am ok with slight overhead of multiple struts-config file (in web.xml approach). I agree that any overhead difference here wouldn't matter (it all happens only once, before the first user request is processed). However, because modules are going to need separate config files anyway, any difference here is vanishingly small. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple modules
So its little funky...what's trick its not working for me I did RequestUtils.selectModule(); and then return new ActionForward(path); at the loading time of the JSP it gives an error that Cannot retrieve mapping for action /iny/INY0110S Any help may be very useful Craig R. McClanahan To: Struts Users Mailing List [EMAIL PROTECTED] [EMAIL PROTECTED]cc: che.org Subject: Re: Multiple modules 09/19/03 10:42 AM Please respond to Struts Users Mailing List On Thu, 18 Sep 2003, Manish Singla wrote: Date: Thu, 18 Sep 2003 20:51:59 -0600 From: Manish Singla [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Multiple modules What are the advantages of having multiple struts-config modules defined in web.xml vs comma separated struts-config.xml from design point of view. In my opinion, the largest single difference between the approaches is really namespace collisions. Consider what happens if two different struts-config.xml files (developed by two independent teams of developers working on portions of your overall application) both try to define an action named /foo, or a global forward named success: * If you are using a single module (one config file or multiple config files isn't relevant -- internally they are all combined into a single set of config entries), the last definition wins -- so someone's code doesn't work correctly unless the identifier is changed. * If you are using multiple modules, each module has its own namespace for actions, forwards, and so on -- so the fact that they share the same identifier doesn't matter. So, multiple modules gives you some protection against this problem, at the (slight) cost that it's a little funky to switch between modules. I am ok with slight overhead of multiple struts-config file (in web.xml approach). I agree that any overhead difference here wouldn't matter (it all happens only once, before the first user request is processed). However, because modules are going to need separate config files anyway, any difference here is vanishingly small. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: The information contained in this message is intended only and solely for the addressed individual or entity indicated in this message and for the exclusive use of the said addressed individual or entity indicated in this message (or responsible for delivery of the message to such person) and may contain legally privileged and confidential information belonging to Tata Consultancy Services. It must not be printed, read, copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person other than the addressee. Unauthorized use, disclosure or copying is strictly prohibited and may constitute unlawful act and can possibly attract legal action, civil and/or criminal. The contents of this message need not necessarily reflect or endorse the views of Tata Consultancy Services on any subject matter. Any action taken or omitted to be taken based on this message is entirely at your risk and neither the originator of this message nor Tata Consultancy Services takes any responsibility or liability towards the same. Opinions, conclusions and any other information contained in this message that do not relate to the official business of Tata Consultancy Services shall be understood as neither given
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]