hai
Multiple submits within a form is possible i found 2 methods with this u
can identify which submit button is pressed
in the servlet eventhough more than 1 submit buttons are in a form in a html
1.give the same name to all submit buttons but give diff. values, and in
the servlet get that value of the object it will
give u the value of the submit button which one is pressed, hope u can do
after that...
2.use one hidden field in the form for every submit button with in the form
call a javascript function which will asssign
the clicked object's value to the hidden field., in the servlet u can get
the value of the hidden field
Hope it will useful for u sample code is here
1.
<form name="myform" action="/servlet/check" method="post" >
<input type="text" name="text1">
<input type="submit" value="Yes" name="yes" >
<input type="submit" value="No" name="yes" >
</form>
2.
<html>
<head>
<script language="javascript">
function Change(obj){
var selbutton=obj.value;
document.myform.option.value=obj.value;
}
</script>
</head>
<body>
<form name="myform" action="/servlet/check" method="post" >
<input type="text" name="text1">
<input type="submit" value="Yes" name="yes" onClick="Change(this);">
<input type="submit" value="No" name="no" onClick="Change(this);" >
<input type="hidden" name="option">
</form>
</body>
</html>
In servlets ie., check.java
String t1=req.getParameter("yes");
PrintWriter out=res.getWriter();
System.out.println("You clicked : " + t1);
out.println("You clicked : " + t1);
> >From: sunil mallya <[EMAIL PROTECTED]>
> >Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> > Servlet API Technology." <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Multiple submits within a form
> >Date: Tue, 15 Aug 2000 04:06:56 -0700
> >
> >Hello all,
> > I have a form . In that form there is a link
> >and a submit button. Now depending on what i click, it
> >should take me to two different servlets . Now is that
> >possible within a form? if so how ?
> >
> >thanks in advance
> >sunil
> >
>
>
> __________________________________________________________________________
> >To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> >of the message "signoff SERVLET-INTEREST".
> >
> >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >Resources: http://java.sun.com/products/servlet/external-resources.html
> >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html