You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Mondkar,Paresh" <Pa...@Syntelinc.com> on 2002/11/01 10:03:25 UTC

Problem in submitting form in Struts 1.0.2

Hi,
   I would appreciate if someone can help me out in the following 
problem.

The problem is that initially I was using javascript functions

function go(){
   document.form.action = "/TrialServlet";
   document.form.parameter.value = "go";
   document.form.submit();
}
and calling the above function in html as shown below
<a href="javascript:go()"><img src="/image1.gif" border="0"></a>

Note that value is a hidden parameter in the html. Which helps me to
identify what action to take.

In the above case I am submitting my form to same TrialServletand 
in the servlet I am checking for request.getParameter("value") 
if it "go" then some action is performed else (say save) 
different action is performed.

Now i want to do the same thing in struts 1.0.2 and without using
javascript.
I have used the DispatchAction class
so I also have to specify the method parameter.

Currently I have used,
<a href="/trial.do?method=processOpenAsmt"><html:image src="/image1.gif" 
property="value" value="go"/></a>

the above tags are not working and form does not get submitted to that 
servlet mentioned in the action attribute of the form tag. Due to this all
the form parameters are not available in the Action class.
I also tried using the below given 3 methods: -

<html:link href="="/trial.do?method=processOpenAsmt"> 
<html:img src="/image1.gif" property="value" 
value="go"/></html:link>

<html:link forward="="/trial.do?method=processOpenAsmt"> 
<html:img src="/image2.gif" property="value" 
value="go"/></html:link>

<html:image src="/image1.gif" property="value" 
value="go"/>

Can anyone help me out......I would appreciate the help.


Regards,
Paresh.P.Mondkar


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Problem in submitting form in Struts 1.0.2

Posted by Karim Saloojee <ka...@hotpop.com>.
I do not think it is possible to submit a form from an href without using
javascript. Either use a button or javascript.

----- Original Message -----
From: "Mondkar,Paresh" <Pa...@Syntelinc.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Friday, November 01, 2002 11:03 AM
Subject: Problem in submitting form in Struts 1.0.2


> Hi,
>    I would appreciate if someone can help me out in the following
> problem.
>
> The problem is that initially I was using javascript functions
>
> function go(){
>    document.form.action = "/TrialServlet";
>    document.form.parameter.value = "go";
>    document.form.submit();
> }
> and calling the above function in html as shown below
> <a href="javascript:go()"><img src="/image1.gif" border="0"></a>
>
> Note that value is a hidden parameter in the html. Which helps me to
> identify what action to take.
>
> In the above case I am submitting my form to same TrialServletand
> in the servlet I am checking for request.getParameter("value")
> if it "go" then some action is performed else (say save)
> different action is performed.
>
> Now i want to do the same thing in struts 1.0.2 and without using
> javascript.
> I have used the DispatchAction class
> so I also have to specify the method parameter.
>
> Currently I have used,
> <a href="/trial.do?method=processOpenAsmt"><html:image src="/image1.gif"
> property="value" value="go"/></a>
>
> the above tags are not working and form does not get submitted to that
> servlet mentioned in the action attribute of the form tag. Due to this all
> the form parameters are not available in the Action class.
> I also tried using the below given 3 methods: -
>
> <html:link href="="/trial.do?method=processOpenAsmt">
> <html:img src="/image1.gif" property="value"
> value="go"/></html:link>
>
> <html:link forward="="/trial.do?method=processOpenAsmt">
> <html:img src="/image2.gif" property="value"
> value="go"/></html:link>
>
> <html:image src="/image1.gif" property="value"
> value="go"/>
>
> Can anyone help me out......I would appreciate the help.
>
>
> Regards,
> Paresh.P.Mondkar
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>