Advertisement
Guest User

files

a guest
Feb 18th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. myFirst.html --------------------------------------------------------------------------------------------
  2.  
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <meta charset="ISO-8859-1">
  7. <link rel = "stylesheet" href ="css/styles.css">
  8. <title>Insert title here</title>
  9. </head>
  10. <body>
  11. <h1>HELLO BABY</h1>
  12. <img src = "images/plane.jpg">
  13. </body>
  14. </html>
  15.  
  16. AnatomyServlet.java -----------------------------------------------------------------------------------------
  17.  
  18.  
  19. package com.ust.iics;
  20.  
  21. import java.io.IOException;
  22. import java.io.PrintWriter;
  23.  
  24. import javax.servlet.ServletConfig;
  25. import javax.servlet.ServletException;
  26. import javax.servlet.annotation.WebServlet;
  27. import javax.servlet.http.HttpServlet;
  28. import javax.servlet.http.HttpServletRequest;
  29. import javax.servlet.http.HttpServletResponse;
  30.  
  31. @WebServlet("/index.html")
  32. public class myFirst extends HttpServlet {
  33. private static final long serialVersionUID = 1L;
  34.  
  35. public myFirst() {
  36. super();
  37. // TODO Auto-generated constructor stub
  38. }
  39.  
  40. public void init(ServletConfig config) throws ServletException {
  41. System.out.println("Startup");
  42. }
  43.  
  44. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  45. // TODO Auto-generated method stub
  46. response.setContentType("text/html");
  47.  
  48. PrintWriter out = response.getWriter();
  49.  
  50. out.println("<html>");
  51. out.println(" <head>");
  52. out.println(" <title>Anatomy of a Servlet </title>");
  53. out.println(" </head>");
  54. out.println("<body>");
  55. out.println(" <h1> Servlet Anatomy Demo </h1>");
  56. out.println("</body>");
  57. out.println("</html>");
  58. out.close();
  59. }
  60.  
  61. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  62. // TODO Auto-generated method stub
  63. doGet(request, response);
  64. System.out.println("doPost");
  65. }
  66.  
  67. public void destroy() {
  68. // TODO Auto-generated method stub
  69. }
  70.  
  71.  
  72. }
  73.  
  74. doGet.html -----------------------------------------------------------------------------------------------
  75.  
  76. <!DOCTYPE html>
  77. <html>
  78. <head>
  79. <meta charset="ISO-8859-1">
  80. <title>Do Get</title>
  81. </head>
  82. <body>
  83.  
  84. <h1>Hello my fellow Thomasian!</h1>
  85. <img src = "images/ust.jpg" width = "30%" height = "25%">
  86.  
  87. <form action = "login.html" method = "get">
  88. <p>Username: <input type = "text" name = "txtusername" size = "20">
  89. <p>Password: <input type = "password" name = "txtpassword" size = "20">
  90. <p><input type = "submit" value = "Login">
  91. </form>
  92. </body>
  93. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement