Problem with ActionClass
I have my Action class and i am using struts framework.I am using Oracle JDeveloper 10g for developing web application.I am trying to save ActionErrors using saveErrors method but i get this follownig error
Error(80,14): method saveErrors(javax.servlet.http.HttpSession, org.apache.struts.action.ActionMessages) not found in class labmonitor.EqpChkOutAction
following is my full code :
package labmonitor;
import java.io.IOException;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.ActionMessage;
public class EqpChkOutAction extends Action {
/**This is the main action called from the Struts framework.
* @param mapping The ActionMapping used to select this instance.
* @param form The optional ActionForm bean for this request.
* @param request The HTTP Request we are processing.
* @param response The HTTP Response we are processing.
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws IOException,ServletException {
Connection connection=null;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
String connectionURL = "jdbc:mysql://localhost:3306/test";
//Connection connection = null;
Statement statement = null;
int transactionId=0;
connection = DriverManager.getConnection(connectionURL, "", "");
connection.setAutoCommit(false);
statement = connection.createStatement();
String studentId=(String)request.getParameter("studentId");
String monitorId=(String)request.getParameter("monitorId");
String eqpId=(String)request.getParameter("equipmentId1");
String staffComment=(String)request.getParameter("staffComment");
String borrowDate=(String)request.getParameter("borrowDate");
String dueDate=(String)request.getParameter("dueDate");
System.out.println("borrowDate : "+borrowDate);
System.out.println("dueDate : "+dueDate);
StringBuffer q1= new StringBuffer();
int available = 0;
q1.append("select ifnull(count(*),0) from equipment where availqty>reservedqty and equipmentid='"+eqpId+"'");
ResultSet rs = statement.executeQuery(q1.toString());
while(rs.next()) {
available=rs.getInt(1);
}
if(available>0)
{
q1.setLength(0);
q1.append("select ifnull(max(transactionid),0)+1 from borrows");
rs = statement.executeQuery(q1.toString());
while(rs.next()) {
transactionId=rs.getInt(1);
}
System.out.println("");
q1.setLength(0);
q1.append("INSERT into borrows(transactionId,studentid,monitorid,equipmentid,borrow_date,return_date,comments) values('"+transactionId+"','"+studentId+"','"+monitorId+"','"+eqpId+"','"+borrowDate+"','"+dueDate+"','"+staffComment+"')");
System.out.println("Equipment Chk Out Query : "+q1.toString());
statement.executeUpdate(q1.toString());
q1.setLength(0);
q1.append("UPDATE equipment set availqty=availqty-1 where equipmentid='"+eqpId+"'");
statement.executeUpdate(q1.toString());
connection.commit();
}
else {
ActionMessages errors = new ActionMessages();
ActionMessage error = new ActionMessage("errors.EquipmentReserved");
errors.add("loginInvalid", error);
saveErrors(request.getSession(),errors);
//saveErrors(request,errors);
//EqpChkOutAction.saveErrors(request,errors);
return mapping.findForward("notAvailable");
}
connection.close();
}
catch(Exception e) {
System.out.println(e);
connection.rollback();
return mapping.findForward("failure");
}
//finally {
//connection.close();
//}
return mapping.findForward( "success");
}
}
please let me know what is the error;

