<tr>
<th><input type="submit" value="Submit" name="button" /></th>
<th><input type="submit" value="Update" name="button" /></th>
<th><input type="submit" value="Delete" name="button" /></th>
</tr>
-
1
-
-
-
-
chamini prashakthi wrote:I want to set separate actions for three buttons in same jsp page.How can I do it?
<tr>
<th><input type="submit" value="Submit" name="button" /></th>
<th><input type="submit" value="Update" name="button" /></th>
<th><input type="submit" value="Delete" name="button" /></th>
</tr>
So you need to have 3 buttons and the action to be performed by the button with different functions
-
1
-
-
-
-
Swastik
Do you mean about use this kind of thing?
<input type="submit" value="Submit" name="button" formaction="path of the relevent redirect jsp page">
<input type="submit" value="Delete" name="button" formaction="path of the relevent redirect jsp page">
but it doesn't work for me...




but it dosen't work for me :cry:
<form action="Approve/Approve/insertform.jsp method="post" >
<th><input type="submit" value="Submit" name="button" /></th>
</form>
<form action="Approve/Approve/deleteform.jsp" method="post">
<th><input type="submit" value="Delete" name="button" /></th>
</form>
<form action="Approve/Approve/modifyform.jsp" method="post">
<th><input type="submit" value="Update" name="button" /></th>
</form>
but it doesn't help for me!!!
:confused:
chamini prashakthi wrote:Do you mean this kind of thing???
but it dosen't work for me :cry:
<form action="Approve/Approve/insertform.jsp method="post" >
<th><input type="submit" value="Submit" name="button" /></th>
</form>
<form action="Approve/Approve/deleteform.jsp" method="post">
<th><input type="submit" value="Delete" name="button" /></th>
</form>
<form action="Approve/Approve/modifyform.jsp" method="post">
<th><input type="submit" value="Update" name="button" /></th>
</form>
but it doesn't help for me!!!
:confused:
Kindly share the error/logs/error message you are receiving when it doesn't work. The methods mentioned by Swastik are few of the methods which can be implemented and it will work.
What are your exact requirement? and share the whole code snippet if you are facing any issues.
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Approver</title>
</head>
<body>
<form action="Approve/Approve/modifyform.jsp">
<table>
<h1>Approval</h1>
<tr>
<th>Approve ID:</th>
<th><input type="text" name="Approve_ID" value="" size="20"/></th>
</tr>
<tr>
<th>Notifications:</th>
<th><input type="text" name="Notofications" value="" size="20"/></th>
</tr>
<tr>
<th><input type="submit" value="Submit" name="button" /></th>
<th><input type="submit" value="Delete" name="button" /></th>
<th><input type="submit" value="Update" name="button" /></th>
</tr>
</table>
</body>
</html>
then I want to redirect 3 separate jsp pages for three buttons Submit,Delete and Update.
submit form is-->
<%@page import="calls.ApproveCalls"%>
<%@page import="entity.Approver"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Map.Entry"%>
<%@page import="java.util.Set"%>
<%@ page import = "java.util.Map" %>
<jsp:useBean id="sample" scope="page" class="calls.ApproveCalls" />
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
ApproveCalls approvecalls = new ApproveCalls();
Approver activity = new Approver(request.getParameter("Approve_ID"),request.getParameter("Notofications"));
activity.setApproverId(activity.getApproverId());
activity.setNotifications(activity.getNotifications());
approvecalls.insertData(activity);
%>
delete form is -->
<%@page import="calls.ApproveCalls"%>
<%@page import="entity.Approver"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Map.Entry"%>
<%@page import="java.util.Set"%>
<%@ page import = "java.util.Map" %>
<jsp:useBean id="sample" scope="page" class="calls.ApproveCalls" />
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
ApproveCalls approvecalls = new ApproveCalls();
Approver activity = new Approver(request.getParameter("Approve_ID"));
approvecalls.deleteData(activity);
%>
modify form is not finished yet..
I tried previous method and it didn't redirect for next jsp page!
Swastik

It is sorta covered in the JavaRanch Style Guide. |