Una plantilla mínima per als servlets
Una plantilla mínima per als servlets:package cat.albertbaranguer.proves;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ServletBase extends HttpServlet {
public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
process (request, response);
}
public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
process (request, response);
}
protected void process (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletOutputStream os = response.getOutputStream();
os.println( "<html><head><title>Servlet base</title></head><body>" +
"Servlet base" +
"</body></html>");
}
}
Cap comentari:
Publica un comentari a l'entrada