Advertisement
Guest User

Untitled

a guest
Apr 9th, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.40 KB | None | 0 0
  1. !DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <!--Date: Spring 2016-->
  5. <title>Forgot Password</title>
  6. <center>
  7. <head>
  8. <!--Calling the external style sheet-->
  9. <link rel="stylesheet" href="CSS/LoginStyleSheet.css" type="text/css" />
  10. </head>
  11. <body>
  12. <div class="container">
  13. <div class="login">
  14. <h1>Forgot Password</h1>
  15. <form method="post" action="newjsp.jsp">
  16. <p><input type="text" name="email" value="" placeholder="Email"></p>
  17. <p class="submit"><input type="submit" name="commit" value="Forgot Password"></p>
  18. <p><a href="">Back to Login</a></p>
  19. </form>
  20. </div>
  21. </div>
  22. </body>
  23.  
  24. </center>
  25. </html>
  26.  
  27. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  28. <!DOCTYPE html>
  29. <html>
  30. <head>
  31. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  32. <title>JSP Page</title>
  33. </head>
  34. <body>
  35. <h1>Hello World!</h1>
  36. <%
  37. String email = request.getParameter("email");
  38. //add null checks and all
  39. //Similarly get all datamobileno etc
  40. //then call your submitData() method
  41. testServlet myTest = new testServlet();
  42. myTest.submitData(email);
  43. %>
  44. </body>
  45. </html>
  46.  
  47. import java.sql.*;
  48. import java.sql.ResultSet;
  49. import java.sql.SQLException;
  50. import javax.swing.JOptionPane;
  51. //import oracle.jdbc.pool.OracleDataSource;
  52. import java.io.IOException;
  53. import java.io.PrintWriter;
  54. import javax.servlet.ServletException;
  55. import javax.servlet.annotation.WebServlet;
  56. import javax.servlet.http.HttpServlet;
  57. import javax.servlet.http.HttpServletRequest;
  58. import javax.servlet.http.HttpServletResponse;
  59.  
  60.  
  61. @WebServlet(urlPatterns = {"/testServlet"})
  62. public class testServlet extends HttpServlet {
  63.  
  64. public void submitData(String email) throws SQLException, ClassNotFoundException {
  65.  
  66.  
  67. Connection con = null;
  68.  
  69. try {
  70. Class.forName("oracle.jdbc.odbc.JdbcOdbcDriver");
  71. }
  72. catch(ClassNotFoundException ex) {
  73. System.out.println("Error: unable to load driver class!");
  74. System.exit(1);
  75. }
  76.  
  77. con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","javauser","ja vapass");
  78. Statement statement = con.createStatement();
  79.  
  80. String command = "INSERT INTO JAVAUSER.test (TESTER) VALUES ('" + email + "');";
  81. statement.executeUpdate(command);
  82.  
  83. con.close();
  84. }
  85.  
  86. protected void processRequest(HttpServletRequest request, HttpServletResponse response)
  87. throws ServletException, IOException {
  88. response.setContentType("text/html;charset=UTF-8");
  89. try (PrintWriter out = response.getWriter()) {
  90. /* TODO output your page here. You may use following sample code. */
  91. out.println("<!DOCTYPE html>");
  92. out.println("<html>");
  93. out.println("<head>");
  94. out.println("<title>Servlet testServlet</title>");
  95. out.println("</head>");
  96. out.println("<body>");
  97. out.println("<h1>Servlet testServlet at " + request.getContextPath() + "</h1>");
  98. out.println("</body>");
  99. out.println("</html>");
  100. }
  101. }
  102.  
  103. // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
  104. /**
  105. * Handles the HTTP <code>GET</code> method.
  106. *
  107. * @param request servlet request
  108. * @param response servlet response
  109. * @throws ServletException if a servlet-specific error occurs
  110. * @throws IOException if an I/O error occurs
  111. */
  112. @Override
  113. protected void doGet(HttpServletRequest request, HttpServletResponse response)
  114. throws ServletException, IOException {
  115. processRequest(request, response);
  116. }
  117.  
  118. /**
  119. * Handles the HTTP <code>POST</code> method.
  120. *
  121. * @param request servlet request
  122. * @param response servlet response
  123. * @throws ServletException if a servlet-specific error occurs
  124. * @throws IOException if an I/O error occurs
  125. */
  126. @Override
  127. protected void doPost(HttpServletRequest request, HttpServletResponse response)
  128. throws ServletException, IOException {
  129. processRequest(request, response);
  130. }
  131.  
  132. /**
  133. * Returns a short description of the servlet.
  134. *
  135. * @return a String containing servlet description
  136. */
  137. @Override
  138. public String getServletInfo() {
  139. return "Short description";
  140. }// </editor-fold>
  141.  
  142. }
  143.  
  144. HTTP Status 500 - Internal Server Error
  145.  
  146.  
  147. type Exception report
  148.  
  149. messageInternal Server Error
  150.  
  151. descriptionThe server encountered an internal error that prevented it from fulfilling this request.
  152.  
  153. exception
  154. org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP
  155.  
  156. PWC6199: Generated servlet error:
  157. source value 1.5 is obsolete and will be removed in a future release
  158.  
  159. PWC6199: Generated servlet error:
  160. target value 1.5 is obsolete and will be removed in a future release
  161.  
  162. PWC6199: Generated servlet error:
  163. To suppress warnings about obsolete options, use -Xlint:-options.
  164.  
  165. PWC6197: An error occurred at line: 16 in the jsp file: /newjsp.jsp
  166. PWC6199: Generated servlet error:
  167. cannot find symbol
  168. symbol: class testServlet
  169. location: class org.apache.jsp.newjsp_jsp
  170.  
  171. PWC6197: An error occurred at line: 16 in the jsp file: /newjsp.jsp
  172. PWC6199: Generated servlet error:
  173. cannot find symbol
  174. symbol: class testServlet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement