I have a
jsp page that calls a scriptlet from within when a submit button is clicked. The problem I am having is that whenever the jsp page is refreshed the scriptlet is also executed. I only want the code to be called when the submit button is clicked.
Any ideas on how to do this would be greatly appreciated. Below is my code.
<%@ page contentType="text/html; charset=iso-8859-1"
language="java"
import="java.io.*,
com.build.AntRun"
%>
<jsp:useBean id="AntBean" class="com.build.AntRun" scope="session"></jsp:useBean>
<html>
<head>
<title>Application Server Bounce</title></head>
<body
<%
if ((request.getParameter("BounceServerA") != null)) {
session.setAttribute("submitted", "yes");
System.out.println("==========it is now working");
}
%>
<form name="form1" method="post" action="BounceServer.jsp">
<p>Select the server application to bounce. </p>
<input type="Submit" name="BounceServerA" value="Bounce Application on Server1" >
</form1>
</body>
</html>