The execute method can be used to put code that will apply to all the dispatched methods.
*--------------------------------------------------------------- public class BasicInfoAction extends DispatchAction { private String thing1; private String thing2; public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { thing1="The cat in a hat" thing2="The cat in a hat" request.getSession().setAttribute("thing1", thing1); request.getSession().setAttribute("thing2", thing2); return super.execute(mapping, form, request, response); } public ActionForward display(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { System.out.println("method=display"); return mapping.getInputForward(); } *-------------------------------------------------------- -Eric >>> [EMAIL PROTECTED] 03/08/05 9:54 AM >>> Hey Rick, Thanks for your reply. On Tue, 08 Mar 2005 10:18:30 -0500, Rick Reumann <[EMAIL PROTECTED]> wrote: > Basile Passe wrote the following on 3/7/2005 12:49 PM: > > > The value of the request parameter named "method" to pick the > > appropriate "execute" method is not valid. But why? struts-config.xml > > is correct and form (JSP) also. > > Well, not sure exactly what you mean above. I'm assuming since you said > it works 95% of the time, you do have typical dispatch method names. > When you use a DispatchAction you typically don't code the execute > method (that's handled by the base class). The execute method of the > base class chooses the correct method in your dispatch action. From your I understand your description of DispatchAction and my use is good. > stack trace it's apparent that you are "NOT" always passing the "method" I'm sure we passing the good "method" parameter but sometimes the error appears in the stack trace!. > parameter like you say you are OR the method param you are passing does > not match the method name in the dispatch action (check for typos). Use > a debugger or print out the request params that are being passed. I don't have the possibilities to reproduce the error. The error appears in production (error occurs from time to time). ;) > > (PS- It's not a good idea to reply to another topic and change the > subject, since it messes up the threading of messages. This message and > your original is now burried within the "Two CSS files" thread) Sorry :P > > > > > Have you an idea for resolve this problem ? > > > > Sorry for my poor english ;) > > > > Basile Passe > > > > Error trace : > > java.lang.NullPointerException > > at java.lang.Class.getMethod0 (Native Method) > > at java.lang.Class.getMethod (Class.java:888) > > at org.apache.struts.actions.DispatchAction.getMethod > > (DispatchAction.java:334) > > at org.apache.struts.actions.DispatchAction.dispatchMethod > > (DispatchAction.java:266) > > at adsn.fcddv.framework.struts.BaseDispatchAction.execute > > (BaseDispatchAction.java:76) > > at org.apache.struts.action.RequestProcessor.processActionPerform > > (RequestProcessor.java:446) > > at adsn.fcddv.framework.struts.CustomRequestProcessor.process > > (CustomRequestProcessor.java:101) > > at org.apache.struts.action.ActionServlet.process > > (ActionServlet.java:1292) > > at org.apache.struts.action.ActionServlet.doGet > > (ActionServlet.java:492) > > at javax.servlet.http.HttpServlet.service (HttpServlet.java:740) > > at javax.servlet.http.HttpServlet.service (HttpServlet.java:853) > > at com.evermind.server.http.ResourceFilterChain.doFilter > > (ResourceFilterChain.java:65) > > at oracle.security.jazn.oc4j.JAZNFilter.doFilter > > (JAZNFilter.java:283) > > at com.evermind.server.http.ServletRequestDispatcher.invoke > > (ServletRequestDispatcher.java:560) > > at com.evermind.server.http.ServletRequestDispatcher.forwardInternal > > (ServletRequestDispatcher.java:306) > > at com.evermind.server.http.HttpRequestHandler.processRequest > > (HttpRequestHandler.java:767) > > at com.evermind.server.http.HttpRequestHandler.run > > (HttpRequestHandler.java:259) > > at com.evermind.server.http.HttpRequestHandler.run > > (HttpRequestHandler.java:106) > > at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run > > (PooledExecutor.java:803) > > at java.lang.Thread.run (Thread.java:484) > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- > Rick > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > Best regards, Basile --------------------------------------------------------------------- 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]