Skip to content

Instantly share code, notes, and snippets.

@kundzi
Created September 30, 2017 07:50
Show Gist options
  • Select an option

  • Save kundzi/fbcbbede492c41a9946a7f89a9260bf3 to your computer and use it in GitHub Desktop.

Select an option

Save kundzi/fbcbbede492c41a9946a7f89a9260bf3 to your computer and use it in GitHub Desktop.
package by.htp.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class FirstServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
response.getWriter().println("This is " + getClass().getName() + ",using the GET method");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
response.getWriter().println("This is " + getClass().getName() + ",using the POST method");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment