Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myFirst.html --------------------------------------------------------------------------------------------
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="ISO-8859-1">
- <link rel = "stylesheet" href ="css/styles.css">
- <title>Insert title here</title>
- </head>
- <body>
- <h1>HELLO BABY</h1>
- <img src = "images/plane.jpg">
- </body>
- </html>
- AnatomyServlet.java -----------------------------------------------------------------------------------------
- package com.ust.iics;
- import java.io.IOException;
- import java.io.PrintWriter;
- import javax.servlet.ServletConfig;
- import javax.servlet.ServletException;
- import javax.servlet.annotation.WebServlet;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- @WebServlet("/index.html")
- public class myFirst extends HttpServlet {
- private static final long serialVersionUID = 1L;
- public myFirst() {
- super();
- // TODO Auto-generated constructor stub
- }
- public void init(ServletConfig config) throws ServletException {
- System.out.println("Startup");
- }
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // TODO Auto-generated method stub
- response.setContentType("text/html");
- PrintWriter out = response.getWriter();
- out.println("<html>");
- out.println(" <head>");
- out.println(" <title>Anatomy of a Servlet </title>");
- out.println(" </head>");
- out.println("<body>");
- out.println(" <h1> Servlet Anatomy Demo </h1>");
- out.println("</body>");
- out.println("</html>");
- out.close();
- }
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // TODO Auto-generated method stub
- doGet(request, response);
- System.out.println("doPost");
- }
- public void destroy() {
- // TODO Auto-generated method stub
- }
- }
- doGet.html -----------------------------------------------------------------------------------------------
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="ISO-8859-1">
- <title>Do Get</title>
- </head>
- <body>
- <h1>Hello my fellow Thomasian!</h1>
- <img src = "images/ust.jpg" width = "30%" height = "25%">
- <form action = "login.html" method = "get">
- <p>Username: <input type = "text" name = "txtusername" size = "20">
- <p>Password: <input type = "password" name = "txtpassword" size = "20">
- <p><input type = "submit" value = "Login">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement