Good morning, Carlos,
I have been busy trying to put this page together, so there are undoubtedly some of these problems. You are right. The name of this class was SimpleDispatchAction. Since this page is rather under construction, some things like logging and so on have not been carefully edited. You should mainly just make sure that you follow the general gist of things.
If you have any particular questions, please let me know.
Michael McGrady
Carlos Cajina - Hotmail wrote:
Good morning.
Thanks to Mr. McGrady for his suggestion. I think the persistent nature of the need to handle multiple (image) buttons in web applications is precisely what makes this problem so recurrent ;^) I've moved from the 'ImageButtonBeanManager Extension' approach and decided to try to get SOLUTION TWO up & running but I've ran into a few problems and thought that maybe you could spare some time to help me out.
Issue #1 ----------- - In the SOLUTON ONE: DispatchUtil Solution Code the 'log' variable declaration is as follows: protected static Log log = LogFactory.getLog(DispatchUtil.class); - In the SOLUTION TWO: (new) DispatchAction Solution Code the 'log' variable declaration is as follows: protected static Log log = LogFactory.getLog(SimpleDispatchAction.class); * My first question is: In the second 'log' variable declaration, Where does SimpleDispatchAction.class comes from? Shouldn't it read DispatchAction.class?
Issue #2 ----------- - I have a class that extends my (new) DispatchAction class. Within this class I have coded the methods that will perform the actions referenced by the <html:submit...> buttons in my forms, i.e. public ActionForward [ next | back | finish ] ( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ... } - In my JSP forms, every button is defined like this: <html:form action="/wizard"> <html:hidden property="page" value="[ 1 | 2 | 3... ]" />
<bean:message key="someField.label" /> <html:text property="someField" />
<html:submit property="back.dispatch"> <bean:message key="button.back" /> </html:submit>
<html:cancel> <bean:message key="button.cancel" /> </html:cancel>
<html:submit property="next.dispatch"> <bean:message key="button.next" /> </html:submit> </html:form> * My second question is kinda stupid: What's next? I mean, It seems like I can use struts-config.xml to get things working MappingDispatchAction style or LookupDispatchAction style, but since the (new) DispatchAction (aka DispatchUtil) takes care of things transparently, What would be the next step to implement SOLUTION TWO?
Issue #3 ----------- * I don't get what this means :^( [Section 3.1. Action Class Code to Use] "In all the following tag uses, you use the Action class code in execute(...) or process(...) as given directly below. ActionForward = forward = new DispatchUtil().dispatch(this,mapping,form,request,response);"
Again, any help would be greatly appreciated.
Have a nice day!
Regards,
Carlos
----- Original Message ----- From: "Michael McGrady" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, September 23, 2004 9:00 PM
Subject: Re: [HOW TO? ImageButtonBeanManager Extension]
documentation I understand that what I need to do is create my Action FlowCarlos,
This solution just adds weight (ImageButtonBean) on top of (DispatchAction) and combines what are the same solutions really. I would suggest you look at what might be improvements to this sort of suggestion at http://wiki.apache.org/struts/StrutsCatalogFiveMultipleButtonSolutions .
Amazing how oftent this comes up.
Michael McGrady
Carlos Cajina - Hotmail wrote:
Hi. I'm tryin' to add this Strust extension to my project and from the
using the SubmitButtonForwardDispatchAction, but after coding my Action Form
and Action classes and setting up struts-config.xml I keep getting this
error:
Looking for Action instance for class2004-09-23 19:10:08,062 DEBUG [org.apache.struts.action.RequestProcessor]
com.mitranosoft.struts.actions.SubmitButtonForwardDispatchAction
Creating new Action instance2004-09-23 19:10:08,062 DEBUG [org.apache.struts.action.RequestProcessor]
[com.mitranosoft.struts.actions.SubmitButtonForwardDispatchAction]2004-09-23 19:10:08,156 WARN
SubmitButtonForwardDispatchAction.execute(): Warning - Error encountered and
handled while attempting to locate ActionForward property-name=[ submit ] of
[EMAIL PROTECTED], for Request=[
[EMAIL PROTECTED]/webm/asiste
nte.do,contextPath=/webm,method=POST,queryString=<null>,sessionId=BDCA619715
A1B419D6785F9CAADC7185] ].
[com.mitranosoft.struts.util.DefaultActionForwardSelector]2004-09-23 19:10:08,156 DEBUG
DefaultActionForwardSelector.getActionForward(): Returning a default
ActionForward matching name=[ otherwise ]. ActionForward=[
[EMAIL PROTECTED],path=/index.js
p,redirect=false,contextRelative=false] ], ActionForm=[
[EMAIL PROTECTED] ], for Request=[
[EMAIL PROTECTED]/webm/asiste
nte.do,contextPath=/webm,method=POST,queryString=<null>,sessionId=BDCA619715
A1B419D6785F9CAADC7185] ]
[com.mitranosoft.struts.actions.SubmitButtonForwardDispatchAction]2004-09-23 19:10:08,156 WARN
SubmitButtonForwardDispatchAction.execute(): Warning - A default ActionForm
has been selected or created, ActionForward=[
[EMAIL PROTECTED],path=/index.js
p,redirect=false,contextRelative=false] ], because no property was found for
property-name=[ submit ] of [EMAIL PROTECTED], for
Request=[
[EMAIL PROTECTED]/webm/asiste
nte.do,contextPath=/webm,method=POST,queryString=<null>,sessionId=BDCA619715
A1B419D6785F9CAADC7185] ]
processForwardConfig(ForwardConfig[name=otherwise,path=/index.jsp,redirect=f2004-09-23 19:10:08,156 DEBUG [org.apache.struts.action.RequestProcessor]
alse])
'back', 'finish'- In each of JSP's I have this for my buttons except for <html:cancel>: <html:submit property="submit">
<bean:message key="button.XXXX" /> // Where XXXX could be 'next',
SubmitButtonForwardDispatchAction action- does the job of automatically</html:submit>
I understand that the extension -through the
mapping a <html:submit...> button to an Action that is supposed to process
the specific business logic that button encapsulates, acting like some kind
of hub for every incoming button click in the JSP forms, but I don't know
whether I am missing something because things just won't work.
SubmitButtonForwardDispatchAction for a 'cancel' action works fine, wheneverIt's worth saying that the mapping in the
I hit the cancel button in my form I'm redirected to the correct location;
also the 'otherwise' mapping works good... it's were I'm taken to everytime
I hit the next button and the errors pops up in the log files :^P
For any help, my eternal gratitude :^)
Have a nice evening.
Regards,
Carlos
--------------------------------------------------------------------- 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]