import java.io.File; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class dibujo_carta */ @WebServlet("/dibujo_carta") public class dibujo_carta extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public dibujo_carta() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter escribirPagina = response.getWriter(); try { String palo = request.getParameter("P0"); int valor = Integer.parseInt(request.getParameter("P1")); palo = palo.toUpperCase(); if(palo.compareTo("S")==0 || palo.compareTo("H")==0 || palo.compareTo("C")==0 || palo.compareTo("D")==0) { if(valor>=1 && valor<=13) { escribirPagina.append( "\n" + "\n" + "
\n" + "\n" + "El campo valor solo admite valores entre entre el 1 y el 13
El campo del palo solo admite valores:
* S
* H
* C
* D
El campo del valor solo admite numeros enteros