I work on my graduation project on 2 different computers, the problem is every time i copy from here to there i get endless errors and problems specifically with on submit servlets for example i have a registration form that takes registered user info through a servlet to another which connects it to another database, when i tried on one of the computers it worked fine but now as i took it home i get the The requested resource () is not available. error.
Here is the registration JSP form method and submit
<form name="myForm" action="RegisterUSER" onsubmit="return validateForm()" method="post">
Here i have all the registration fields and drop boxes and at the ned i have this
<input type="submit" value="Register" name="Register" />
</br>
</form>
And here is the servlet that it should submit to(the one netbeans cant find).
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class RegisterUSER extends HttpServlet {
protected static void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String First_Name=request.getParameter("FirstName");
String Middle_Name=request.getParameter("MiddleName");
String Last_Name=request.getParameter("LastName");
String Username=request.getParameter("Username");
String Email_Address=request.getParameter("EmailAddress");
String Password=request.getParameter("Password");
String Birth_date=request.getParameter("Birthdate");
String ID=request.getParameter("ID");
Connecttodatabase con=new Connecttodatabase();
int x=0;
try{
x =con.insertusersToDatabase(First_Name, Middle_Name, Last_Name, Username, Email_Address, Password, Birth_date, ID);
}
catch(Exception e){
System.err.println("Got an exception!");
System.err.println(e.getMessage());
}
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet Registration</title>");
out.println("</head>");
out.println("<body>");
request.getContextPath ();
out.println("Registration Complete " +x);
out.println(Username);
out.println("</body>");
out.println("</html>");
out.close();
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try{
processRequest(request, response);
} catch(Exception e){
System.err.println("Got an exception!");
System.err.println(e.getMessage());
}
}
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try{
processRequest(request, response);
} catch(Exception e){
System.err.println("Got an exception!");
System.err.println(e.getMessage());
}
}
/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
// </editor-fold>
}