Hi,

at first my code.

my DispatchAction-Class:
public class ExampleAction extends DispatchAction {

        public ActionForward delete(ActionMapping mapping, ActionForm form,
                        HttpServletRequest request, HttpServletResponse 
response) throws
Exception {
                System.out.println("******* delete");
                return mapping.findForward("continue");
        }
        
        public ActionForward add(ActionMapping mapping, ActionForm form,
                        HttpServletRequest request, HttpServletResponse 
response) throws
Exception {
                
                System.out.println("******* add");
                
        return mapping.findForward("continue");
        }
}

my jsp:
<html:html>
<head>
</head>
<body>  
        <html:form action="/ExampleSubmit">
                <html:submit onclick="this.form.method.value='delete'">
                </html:submit>
            
        </html:form>    
</body>
</html:html>

and the part of the struts-config.xml:
<action path="/ExampleShow"
                        type="org.apache.struts.actions.ForwardAction"
                        parameter="/jsp/Example.jsp"/>
                
                <action    path="/ExampleSubmit"
                type="ExampleAction"
                name="exampleForm"
                scope="request"
                input="/jsp/Example.jsp"
                parameter="method">

        <forward name="continue"    
                 path="/jsp/Example.jsp" redirect="true"/>
                </action>

When click of the button, I get this error:
----------------------------------------------------------------------------------------------------------------------------------------
javax.servlet.ServletException: javax.servlet.ServletException:
Request[/ExampleSubmit] does not contain handler parameter named 'method'. 
This may be caused by whitespace in the label text.

org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
        org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
        org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

javax.servlet.ServletException: Request[/ExampleSubmit] does not contain
handler parameter named 'method'.  This may be caused by whitespace in the
label text.

org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:197)

org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:245)
        
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)

org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)

org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)

org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
        org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)

org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
        org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)

org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
        org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
        org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
-----------------------------------------------------------------------------------------------------------------------------------

It is working if I type manualy ExampleSubmit.do?method=delete
(The delete-method in the action-class ist calling)


It is also working with this submit-button:
<html:submit property="method" value="delete"/>

But why doesn't work <html:submit onclick="this.form.method.value='delete'">
                </html:submit> ?


This should be the same like in this example:
http://struts.apache.org/1.x/struts-extras/dispatchValidator.html
-- 
View this message in context: 
http://www.nabble.com/Trouble-with-DispatchAction-tf3696632.html#a10337147
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to