RE: Can we create a Action class object
Sure, just instantiate it and call its perform (execute in struts 1.1) method, passing your mapping, for, request and response refs. Dont forget to set the ActionServlet reference first! (Of course it gets much more complicated if you dont want to give it the same mapping and form as your calling action is using! :-( ) disclaimer Like action-chaining the need to do this is however probably a good indication that your actions have too much business logic in them (which should be in business classes invoked by the actions) and you might want to consider how you could improve your architecture a bit! /disclaimer -Original Message- From: Ashok.D [mailto:[EMAIL PROTECTED] Sent: Thursday, 4 September 2003 21:42 To: Struts Users Mailing List Subject: Can we create a Action class object Hi, Can we create a Action class object. I need to access the perform method from another Action class. If we access this Action class by using *.do, I have some limiations in my application. I don't want to use action.do. But I need to execute another action class perform method. Pls put some light on this issue. Thanks Regards, Ashok.D - 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: Can we create a Action class object
Why? This sounds like bad design. Why not just refactor the common code out into a helper class and call that from both actions? -- Danny Yates -Original Message- From: Ashok.D [mailto:[EMAIL PROTECTED] Sent: 04 September 2003 14:42 To: Struts Users Mailing List Subject: Can we create a Action class object Hi, Can we create a Action class object. I need to access the perform method from another Action class. If we access this Action class by using *.do, I have some limiations in my application. I don't want to use action.do. But I need to execute another action class perform method. Pls put some light on this issue. Thanks Regards, Ashok.D - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Notice to recipient: The information in this internet e-mail and any attachments is confidential and may be privileged. It is intended solely for the addressee. If you are not the intended addressee please notify the sender immediately by telephone. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to external clients any opinions or advice contained in this internet e-mail are subject to the terms and conditions expressed in any applicable governing terms of business or client engagement letter issued by the pertinent Bank of America group entity. If this email originates from the U.K. please note that Bank of America, N.A., London Branch, Banc of America Securities Limited and Banc of America Futures Incorporated are regulated by the Financial Services Authority. _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can we create a Action class object
Danny is right you know. I probably didnt stress the point well enough in my own response to the question just now. You would be much better off doing a spot of refactoring. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, 4 September 2003 22:37 To: [EMAIL PROTECTED] Subject: RE: Can we create a Action class object Why? This sounds like bad design. Why not just refactor the common code out into a helper class and call that from both actions? -- Danny Yates -Original Message- From: Ashok.D [mailto:[EMAIL PROTECTED] Sent: 04 September 2003 14:42 To: Struts Users Mailing List Subject: Can we create a Action class object Hi, Can we create a Action class object. I need to access the perform method from another Action class. If we access this Action class by using *.do, I have some limiations in my application. I don't want to use action.do. But I need to execute another action class perform method. Pls put some light on this issue. Thanks Regards, Ashok.D - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Notice to recipient: The information in this internet e-mail and any attachments is confidential and may be privileged. It is intended solely for the addressee. If you are not the intended addressee please notify the sender immediately by telephone. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to external clients any opinions or advice contained in this internet e-mail are subject to the terms and conditions expressed in any applicable governing terms of business or client engagement letter issued by the pertinent Bank of America group entity. If this email originates from the U.K. please note that Bank of America, N.A., London Branch, Banc of America Securities Limited and Banc of America Futures Incorporated are regulated by the Financial Services Authority. _ - 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: Can we create a Action class object
Hi Andrew Hill, Thanks for your reply. Can I know about setting the ActionServlet reference first!. Thanks Regards, Ashok.D - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, September 04, 2003 7:58 PM Subject: RE: Can we create a Action class object Sure, just instantiate it and call its perform (execute in struts 1.1) method, passing your mapping, for, request and response refs. Dont forget to set the ActionServlet reference first! (Of course it gets much more complicated if you dont want to give it the same mapping and form as your calling action is using! :-( ) disclaimer Like action-chaining the need to do this is however probably a good indication that your actions have too much business logic in them (which should be in business classes invoked by the actions) and you might want to consider how you could improve your architecture a bit! /disclaimer -Original Message- From: Ashok.D [mailto:[EMAIL PROTECTED] Sent: Thursday, 4 September 2003 21:42 To: Struts Users Mailing List Subject: Can we create a Action class object Hi, Can we create a Action class object. I need to access the perform method from another Action class. If we access this Action class by using *.do, I have some limiations in my application. I don't want to use action.do. But I need to execute another action class perform method. Pls put some light on this issue. Thanks Regards, Ashok.D - 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: Can we create a Action class object
The Action class normally has a reference to the ActionServlet that is set by the ActionServlet or RequestProcessor (I forget which) when the object is instantiated. If you are instantiating an Action instance yourself you will want to set it, in case the code in the other action needs to get at the servlet reference (or through it to get the ServletContext reference). Action myAction = new MyAction(); myAction.setServlet( getServlet() ); myAction.execute(mapping, form, request, response); Hmm. setServlet() is public in 1.1 final release, but Ive noticed in the nightly docs it now seems to be package protected. That could be very bad for a framework extension Im working on. :-( -but its also another good indication that you ought to factor out the common code into a third class rather than trying to re-use the action! ;-) -Original Message- From: Ashok.D [mailto:[EMAIL PROTECTED] Sent: Thursday, 4 September 2003 22:45 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: Can we create a Action class object Hi Andrew Hill, Thanks for your reply. Can I know about setting the ActionServlet reference first!. Thanks Regards, Ashok.D - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, September 04, 2003 7:58 PM Subject: RE: Can we create a Action class object Sure, just instantiate it and call its perform (execute in struts 1.1) method, passing your mapping, for, request and response refs. Dont forget to set the ActionServlet reference first! (Of course it gets much more complicated if you dont want to give it the same mapping and form as your calling action is using! :-( ) disclaimer Like action-chaining the need to do this is however probably a good indication that your actions have too much business logic in them (which should be in business classes invoked by the actions) and you might want to consider how you could improve your architecture a bit! /disclaimer -Original Message- From: Ashok.D [mailto:[EMAIL PROTECTED] Sent: Thursday, 4 September 2003 21:42 To: Struts Users Mailing List Subject: Can we create a Action class object Hi, Can we create a Action class object. I need to access the perform method from another Action class. If we access this Action class by using *.do, I have some limiations in my application. I don't want to use action.do. But I need to execute another action class perform method. Pls put some light on this issue. Thanks Regards, Ashok.D - 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: Can we create a Action class object
I find that this can still be a valid solution, even when business logic is entirely factored out of Actions. For example, I have Form A and Form B, both of which nest Form C. My Actions are all related to LookupDispatchActions. Action A checks the request for Form A specific submissions, and then calls Action C to check for Form C specific submissions. Similarly, Action B checks the request for Form B specific submissions, and then calls Action C to check for Form C specific submissions. Since my business logic is well factored, I could have had Action A and Action B check all the same stuff in the request that Action C does, and then call all the same business logic that Action C does, but why? Then, I would have to do the same in every Action processing a Form which nests Form C. Action C always handles whatever Form C may sumbit on any form in which it is nested; I instantiate it, and execute it, and it's up to the parent Action to determine what to do with the returned forward. I had been doing this with chaining, but we all know where that leads ;) m Andrew Hill [EMAIL PROTECTED] wrote: Danny is right you know. I probably didnt stress the point well enough in my own response to the question just now. You would be much better off doing a spot of refactoring. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, 4 September 2003 22:37 To: [EMAIL PROTECTED] Subject: RE: Can we create a Action class object Why? This sounds like bad design. Why not just refactor the common code out into a helper class and call that from both actions? -- Danny Yates -Original Message- From: Ashok.D [mailto:[EMAIL PROTECTED] Sent: 04 September 2003 14:42 To: Struts Users Mailing List Subject: Can we create a Action class object Hi, Can we create a Action class object. I need to access the perform method from another Action class. If we access this Action class by using *.do, I have some limiations in my application. I don't want to use action.do. But I need to execute another action class perform method. Pls put some light on this issue. Thanks Regards, Ashok.D - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Notice to recipient: The information in this internet e-mail and any attachments is confidential and may be privileged. It is intended solely for the addressee. If you are not the intended addressee please notify the sender immediately by telephone. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to external clients any opinions or advice contained in this internet e-mail are subject to the terms and conditions expressed in any applicable governing terms of business or client engagement letter issued by the pertinent Bank of America group entity. If this email originates from the U.K. please note that Bank of America, N.A., London Branch, Banc of America Securities Limited and Banc of America Futures Incorporated are regulated by the Financial Services Authority. _ - 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] - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software