You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Shishir K. Singh" <sk...@synapsistech.com> on 2003/11/10 23:32:40 UTC

Form submission through java script

Hi, 

I have a form with one drop down menu list and two buttons (continue and
previous ). The two buttons are hooked up to the LookupDispatchAction
where 
I process the code as required by the action of the button. Everything
works fine if I use the buttons. 


My requirement is that when I click on any one value of the list box,
the form should get submitted. I am trying to use Javascript to do the
same. 

In the onclick of the select html:select, I have a function called
submit() 

The submit function looks like this



<script language="text/javascript">
    function submit() {
        document.form.action =
http://localhost:8081/createContentAction.do
        document.form.submit()
    }

</script> 

 
And my form action is 


<html:form  action="/createContentAction">





When I click any value in the drop down, I get this error :


javax.servlet.ServletException: Request[/createContentAction] does not
contain handler parameter named action
	at
org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAct
ion.java:199)
	at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:484)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
274)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
	at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
	at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFi
lter.java:226)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:213)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:243)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:190)


Can anyone pls tell me where am I going wrong or what more needs to be
done ??

TIA
Shishir

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Form submission through java script

Posted by Brice Ruth <br...@fiskars.com>.
Why are you setting the document.form.action? Just call 
document.form.submit() - the JavaScript will automatically know what to 
do and where to submit to.

Shishir K. Singh wrote:

>Hi, 
>
>I have a form with one drop down menu list and two buttons (continue and
>previous ). The two buttons are hooked up to the LookupDispatchAction
>where 
>I process the code as required by the action of the button. Everything
>works fine if I use the buttons. 
>
>
>My requirement is that when I click on any one value of the list box,
>the form should get submitted. I am trying to use Javascript to do the
>same. 
>
>In the onclick of the select html:select, I have a function called
>submit() 
>
>The submit function looks like this
>
>
>
><script language="text/javascript">
>    function submit() {
>        document.form.action =
>http://localhost:8081/createContentAction.do
>        document.form.submit()
>    }
>
></script> 
>
> 
>And my form action is 
>
>
><html:form  action="/createContentAction">
>
>
>
>
>
>When I click any value in the drop down, I get this error :
>
>
>javax.servlet.ServletException: Request[/createContentAction] does not
>contain handler parameter named action
>	at
>org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAct
>ion.java:199)
>	at
>org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
>ocessor.java:484)
>	at
>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
>274)
>	at
>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
>	at
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>	at
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
>tionFilterChain.java:247)
>	at
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
>erChain.java:193)
>	at
>org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFi
>lter.java:226)
>	at
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
>tionFilterChain.java:213)
>	at
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
>erChain.java:193)
>	at
>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
>e.java:243)
>	at
>org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
>va:566)
>	at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
>72)
>	at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>	at
>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
>e.java:190)
>
>
>Can anyone pls tell me where am I going wrong or what more needs to be
>done ??
>
>TIA
>Shishir
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>  
>

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Form submission through java script

Posted by Lynn Guy <lg...@yahoo.com>.
I got this message when I DID want to change the
action.  I had to change the parameter name to xaction
and it worked.  So I'd be suspicious of the name
"submit" as well. Also, I had to change the action to
append the parameter and its value to get it to work
this way.  

--- Yansheng Lin <ya...@isogis.com> wrote:
> If you do a System.out on action, you will find it's
> null right now.
> You need to pass a valid action to the your dispatch
> Action so that it knows
> which handler to call.
> 
> >document.form.action='continue';
> 
> 
> -----Original Message-----
> From: Shishir K. Singh
> [mailto:sksingh@synapsistech.com] 
> Sent: lundi 10 novembre 2003 15:33
> To: Struts Users Mailing List
> Subject: Form submission through java script
> 
> 
> Hi, 
> 
> I have a form with one drop down menu list and two
> buttons (continue and
> previous ). The two buttons are hooked up to the
> LookupDispatchAction
> where 
> I process the code as required by the action of the
> button. Everything
> works fine if I use the buttons. 
> 
> 
> My requirement is that when I click on any one value
> of the list box,
> the form should get submitted. I am trying to use
> Javascript to do the
> same. 
> 
> In the onclick of the select html:select, I have a
> function called
> submit() 
> 
> The submit function looks like this
> 
> 
> 
> <script language="text/javascript">
>     function submit() {
>         document.form.action =
> http://localhost:8081/createContentAction.do
>         document.form.submit()
>     }
> 
> </script> 
> 
>  
> And my form action is 
> 
> 
> <html:form  action="/createContentAction">
> 
> 
> 
> 
> 
> When I click any value in the drop down, I get this
> error :
> 
> 
> javax.servlet.ServletException:
> Request[/createContentAction] does not
> contain handler parameter named action
> 	at
>
org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAct
> ion.java:199)
> 	at
>
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
> ocessor.java:484)
> 	at
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
> 274)
> 	at
>
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
> 	at
>
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
> 	at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> 	at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 	at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:247)
> 	at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:193)
> 	at
>
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFi
> lter.java:226)
> 	at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:213)
> 	at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:193)
> 	at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
> e.java:243)
> 	at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
> va:566)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 72)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> 	at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.java:190)
> 
> 
> Can anyone pls tell me where am I going wrong or
> what more needs to be
> done ??
> 
> TIA
> Shishir
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Form submission through java script

Posted by Yansheng Lin <ya...@isogis.com>.
If you do a System.out on action, you will find it's null right now.
You need to pass a valid action to the your dispatch Action so that it knows
which handler to call.

>document.form.action='continue';


-----Original Message-----
From: Shishir K. Singh [mailto:sksingh@synapsistech.com] 
Sent: lundi 10 novembre 2003 15:33
To: Struts Users Mailing List
Subject: Form submission through java script


Hi, 

I have a form with one drop down menu list and two buttons (continue and
previous ). The two buttons are hooked up to the LookupDispatchAction
where 
I process the code as required by the action of the button. Everything
works fine if I use the buttons. 


My requirement is that when I click on any one value of the list box,
the form should get submitted. I am trying to use Javascript to do the
same. 

In the onclick of the select html:select, I have a function called
submit() 

The submit function looks like this



<script language="text/javascript">
    function submit() {
        document.form.action =
http://localhost:8081/createContentAction.do
        document.form.submit()
    }

</script> 

 
And my form action is 


<html:form  action="/createContentAction">





When I click any value in the drop down, I get this error :


javax.servlet.ServletException: Request[/createContentAction] does not
contain handler parameter named action
	at
org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAct
ion.java:199)
	at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:484)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
274)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
	at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
	at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFi
lter.java:226)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:213)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:243)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:190)


Can anyone pls tell me where am I going wrong or what more needs to be
done ??

TIA
Shishir

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org