diff --git b/ jweb-e001/.settings/_jsdtscope.xml a/ jweb-e001/.settings/_jsdtscope.xml new file mode 100644 index 0000000..92e666d --- /dev/null +++ a/ jweb-e001/.settings/_jsdtscope.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git b/ jweb-e001/.settings/org.eclipse.jdt.core.prefs a/ jweb-e001/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f18fd9d --- /dev/null +++ a/ jweb-e001/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=10 +org.eclipse.jdt.core.compiler.compliance=10 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=10 diff --git b/ jweb-e001/.settings/org.eclipse.wst.common.component.xml a/ jweb-e001/.settings/org.eclipse.wst.common.component.xml new file mode 100644 index 0000000..577a5c4 --- /dev/null +++ a/ jweb-e001/.settings/org.eclipse.wst.common.component.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git b/ jweb-e001/.settings/org.eclipse.wst.common.project.facet.core.xml a/ jweb-e001/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..470b198 --- /dev/null +++ a/ jweb-e001/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git b/ jweb-e001/.settings/org.eclipse.wst.jsdt.ui.superType.container a/ jweb-e001/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ a/ jweb-e001/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git b/ jweb-e001/.settings/org.eclipse.wst.jsdt.ui.superType.name a/ jweb-e001/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ a/ jweb-e001/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git b/ jweb-e001/WebContent/META-INF/MANIFEST.MF a/ jweb-e001/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ a/ jweb-e001/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git b/ jweb-e001/WebContent/agenda.html a/ jweb-e001/WebContent/agenda.html new file mode 100644 index 0000000..adcf54e --- /dev/null +++ a/ jweb-e001/WebContent/agenda.html @@ -0,0 +1,22 @@ + + + + +Agenda + + +

Ingrese los datos del cliente

+
+ +

+ +

+ +

+ +

+ +


+ Volver al menu principal + + \ No newline at end of file diff --git b/ jweb-e001/WebContent/cartas.html a/ jweb-e001/WebContent/cartas.html new file mode 100644 index 0000000..eaabbfd --- /dev/null +++ a/ jweb-e001/WebContent/cartas.html @@ -0,0 +1,32 @@ + + + + + Obten tu carta de poker + + +

Ingrese el palo y el valor de la carta

+
+ +

+ +

+ +
+

+ Palos posibles:
+ * S : Picas (Spades)
+ * H : Corazones (Hearts)
+ * C : Treboles (Clubs)
+ * D : Diamante (Diamonds) +

+

+ Valores posibles: 1 al 13.
+ * 1 equivale al As
+ * 11 equivale al J
+ * 12 equivale al Q
+ * 13 equivales al K +



+ Volver al menu principal + + \ No newline at end of file diff --git b/ jweb-e001/WebContent/cartas/10C.png a/ jweb-e001/WebContent/cartas/10C.png new file mode 100644 index 0000000..2df1faa Binary files /dev/null and a/ jweb-e001/WebContent/cartas/10C.png differ diff --git b/ jweb-e001/WebContent/cartas/10D.png a/ jweb-e001/WebContent/cartas/10D.png new file mode 100644 index 0000000..87c08c2 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/10D.png differ diff --git b/ jweb-e001/WebContent/cartas/10H.png a/ jweb-e001/WebContent/cartas/10H.png new file mode 100644 index 0000000..4036a4a Binary files /dev/null and a/ jweb-e001/WebContent/cartas/10H.png differ diff --git b/ jweb-e001/WebContent/cartas/10S.png a/ jweb-e001/WebContent/cartas/10S.png new file mode 100644 index 0000000..2d6a823 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/10S.png differ diff --git b/ jweb-e001/WebContent/cartas/11C.png a/ jweb-e001/WebContent/cartas/11C.png new file mode 100644 index 0000000..f452968 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/11C.png differ diff --git b/ jweb-e001/WebContent/cartas/11D.png a/ jweb-e001/WebContent/cartas/11D.png new file mode 100644 index 0000000..04f86ce Binary files /dev/null and a/ jweb-e001/WebContent/cartas/11D.png differ diff --git b/ jweb-e001/WebContent/cartas/11H.png a/ jweb-e001/WebContent/cartas/11H.png new file mode 100644 index 0000000..e3fe719 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/11H.png differ diff --git b/ jweb-e001/WebContent/cartas/11S.png a/ jweb-e001/WebContent/cartas/11S.png new file mode 100644 index 0000000..ae8af18 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/11S.png differ diff --git b/ jweb-e001/WebContent/cartas/12C.png a/ jweb-e001/WebContent/cartas/12C.png new file mode 100644 index 0000000..b1a2d1c Binary files /dev/null and a/ jweb-e001/WebContent/cartas/12C.png differ diff --git b/ jweb-e001/WebContent/cartas/12D.png a/ jweb-e001/WebContent/cartas/12D.png new file mode 100644 index 0000000..4ae839b Binary files /dev/null and a/ jweb-e001/WebContent/cartas/12D.png differ diff --git b/ jweb-e001/WebContent/cartas/12H.png a/ jweb-e001/WebContent/cartas/12H.png new file mode 100644 index 0000000..c9312b8 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/12H.png differ diff --git b/ jweb-e001/WebContent/cartas/12S.png a/ jweb-e001/WebContent/cartas/12S.png new file mode 100644 index 0000000..302913c Binary files /dev/null and a/ jweb-e001/WebContent/cartas/12S.png differ diff --git b/ jweb-e001/WebContent/cartas/13C.png a/ jweb-e001/WebContent/cartas/13C.png new file mode 100644 index 0000000..e3b337b Binary files /dev/null and a/ jweb-e001/WebContent/cartas/13C.png differ diff --git b/ jweb-e001/WebContent/cartas/13D.png a/ jweb-e001/WebContent/cartas/13D.png new file mode 100644 index 0000000..4c0963a Binary files /dev/null and a/ jweb-e001/WebContent/cartas/13D.png differ diff --git b/ jweb-e001/WebContent/cartas/13H.png a/ jweb-e001/WebContent/cartas/13H.png new file mode 100644 index 0000000..06ffa8a Binary files /dev/null and a/ jweb-e001/WebContent/cartas/13H.png differ diff --git b/ jweb-e001/WebContent/cartas/13S.png a/ jweb-e001/WebContent/cartas/13S.png new file mode 100644 index 0000000..a5e523d Binary files /dev/null and a/ jweb-e001/WebContent/cartas/13S.png differ diff --git b/ jweb-e001/WebContent/cartas/1C.png a/ jweb-e001/WebContent/cartas/1C.png new file mode 100644 index 0000000..e812d6f Binary files /dev/null and a/ jweb-e001/WebContent/cartas/1C.png differ diff --git b/ jweb-e001/WebContent/cartas/1D.png a/ jweb-e001/WebContent/cartas/1D.png new file mode 100644 index 0000000..c7b1c72 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/1D.png differ diff --git b/ jweb-e001/WebContent/cartas/1H.png a/ jweb-e001/WebContent/cartas/1H.png new file mode 100644 index 0000000..b933626 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/1H.png differ diff --git b/ jweb-e001/WebContent/cartas/1S.png a/ jweb-e001/WebContent/cartas/1S.png new file mode 100644 index 0000000..0d6a437 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/1S.png differ diff --git b/ jweb-e001/WebContent/cartas/2C.png a/ jweb-e001/WebContent/cartas/2C.png new file mode 100644 index 0000000..623487f Binary files /dev/null and a/ jweb-e001/WebContent/cartas/2C.png differ diff --git b/ jweb-e001/WebContent/cartas/2D.png a/ jweb-e001/WebContent/cartas/2D.png new file mode 100644 index 0000000..337527e Binary files /dev/null and a/ jweb-e001/WebContent/cartas/2D.png differ diff --git b/ jweb-e001/WebContent/cartas/2H.png a/ jweb-e001/WebContent/cartas/2H.png new file mode 100644 index 0000000..a1a6537 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/2H.png differ diff --git b/ jweb-e001/WebContent/cartas/2S.png a/ jweb-e001/WebContent/cartas/2S.png new file mode 100644 index 0000000..d79822a Binary files /dev/null and a/ jweb-e001/WebContent/cartas/2S.png differ diff --git b/ jweb-e001/WebContent/cartas/3C.png a/ jweb-e001/WebContent/cartas/3C.png new file mode 100644 index 0000000..b448b24 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/3C.png differ diff --git b/ jweb-e001/WebContent/cartas/3D.png a/ jweb-e001/WebContent/cartas/3D.png new file mode 100644 index 0000000..4216241 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/3D.png differ diff --git b/ jweb-e001/WebContent/cartas/3H.png a/ jweb-e001/WebContent/cartas/3H.png new file mode 100644 index 0000000..15a0ca4 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/3H.png differ diff --git b/ jweb-e001/WebContent/cartas/3S.png a/ jweb-e001/WebContent/cartas/3S.png new file mode 100644 index 0000000..7a0f9d6 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/3S.png differ diff --git b/ jweb-e001/WebContent/cartas/4C.png a/ jweb-e001/WebContent/cartas/4C.png new file mode 100644 index 0000000..8c191e7 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/4C.png differ diff --git b/ jweb-e001/WebContent/cartas/4D.png a/ jweb-e001/WebContent/cartas/4D.png new file mode 100644 index 0000000..3e1fd66 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/4D.png differ diff --git b/ jweb-e001/WebContent/cartas/4H.png a/ jweb-e001/WebContent/cartas/4H.png new file mode 100644 index 0000000..a0f9064 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/4H.png differ diff --git b/ jweb-e001/WebContent/cartas/4S.png a/ jweb-e001/WebContent/cartas/4S.png new file mode 100644 index 0000000..3112e9f Binary files /dev/null and a/ jweb-e001/WebContent/cartas/4S.png differ diff --git b/ jweb-e001/WebContent/cartas/5C.png a/ jweb-e001/WebContent/cartas/5C.png new file mode 100644 index 0000000..9c373be Binary files /dev/null and a/ jweb-e001/WebContent/cartas/5C.png differ diff --git b/ jweb-e001/WebContent/cartas/5D.png a/ jweb-e001/WebContent/cartas/5D.png new file mode 100644 index 0000000..9b4390e Binary files /dev/null and a/ jweb-e001/WebContent/cartas/5D.png differ diff --git b/ jweb-e001/WebContent/cartas/5H.png a/ jweb-e001/WebContent/cartas/5H.png new file mode 100644 index 0000000..6e0ef01 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/5H.png differ diff --git b/ jweb-e001/WebContent/cartas/5S.png a/ jweb-e001/WebContent/cartas/5S.png new file mode 100644 index 0000000..d3dbadf Binary files /dev/null and a/ jweb-e001/WebContent/cartas/5S.png differ diff --git b/ jweb-e001/WebContent/cartas/6C.png a/ jweb-e001/WebContent/cartas/6C.png new file mode 100644 index 0000000..2e499a0 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/6C.png differ diff --git b/ jweb-e001/WebContent/cartas/6D.png a/ jweb-e001/WebContent/cartas/6D.png new file mode 100644 index 0000000..51198ce Binary files /dev/null and a/ jweb-e001/WebContent/cartas/6D.png differ diff --git b/ jweb-e001/WebContent/cartas/6H.png a/ jweb-e001/WebContent/cartas/6H.png new file mode 100644 index 0000000..8e0af7f Binary files /dev/null and a/ jweb-e001/WebContent/cartas/6H.png differ diff --git b/ jweb-e001/WebContent/cartas/6S.png a/ jweb-e001/WebContent/cartas/6S.png new file mode 100644 index 0000000..bf98d68 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/6S.png differ diff --git b/ jweb-e001/WebContent/cartas/7C.png a/ jweb-e001/WebContent/cartas/7C.png new file mode 100644 index 0000000..14d5840 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/7C.png differ diff --git b/ jweb-e001/WebContent/cartas/7D.png a/ jweb-e001/WebContent/cartas/7D.png new file mode 100644 index 0000000..ec443f9 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/7D.png differ diff --git b/ jweb-e001/WebContent/cartas/7H.png a/ jweb-e001/WebContent/cartas/7H.png new file mode 100644 index 0000000..0949f70 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/7H.png differ diff --git b/ jweb-e001/WebContent/cartas/7S.png a/ jweb-e001/WebContent/cartas/7S.png new file mode 100644 index 0000000..e1f4644 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/7S.png differ diff --git b/ jweb-e001/WebContent/cartas/8C.png a/ jweb-e001/WebContent/cartas/8C.png new file mode 100644 index 0000000..643988c Binary files /dev/null and a/ jweb-e001/WebContent/cartas/8C.png differ diff --git b/ jweb-e001/WebContent/cartas/8D.png a/ jweb-e001/WebContent/cartas/8D.png new file mode 100644 index 0000000..8127c96 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/8D.png differ diff --git b/ jweb-e001/WebContent/cartas/8H.png a/ jweb-e001/WebContent/cartas/8H.png new file mode 100644 index 0000000..43e5a2a Binary files /dev/null and a/ jweb-e001/WebContent/cartas/8H.png differ diff --git b/ jweb-e001/WebContent/cartas/8S.png a/ jweb-e001/WebContent/cartas/8S.png new file mode 100644 index 0000000..ef32b3e Binary files /dev/null and a/ jweb-e001/WebContent/cartas/8S.png differ diff --git b/ jweb-e001/WebContent/cartas/9C.png a/ jweb-e001/WebContent/cartas/9C.png new file mode 100644 index 0000000..3447f54 Binary files /dev/null and a/ jweb-e001/WebContent/cartas/9C.png differ diff --git b/ jweb-e001/WebContent/cartas/9D.png a/ jweb-e001/WebContent/cartas/9D.png new file mode 100644 index 0000000..437250a Binary files /dev/null and a/ jweb-e001/WebContent/cartas/9D.png differ diff --git b/ jweb-e001/WebContent/cartas/9H.png a/ jweb-e001/WebContent/cartas/9H.png new file mode 100644 index 0000000..ebbeb1c Binary files /dev/null and a/ jweb-e001/WebContent/cartas/9H.png differ diff --git b/ jweb-e001/WebContent/cartas/9S.png a/ jweb-e001/WebContent/cartas/9S.png new file mode 100644 index 0000000..5082f8c Binary files /dev/null and a/ jweb-e001/WebContent/cartas/9S.png differ diff --git b/ jweb-e001/WebContent/conversor.html a/ jweb-e001/WebContent/conversor.html new file mode 100644 index 0000000..3a262a6 --- /dev/null +++ a/ jweb-e001/WebContent/conversor.html @@ -0,0 +1,22 @@ + + + + +Conversor de temperatura + + +

Ingrese los datos

+
+ +

+ +

+ +


+ Volver al menu principal + + \ No newline at end of file diff --git b/ jweb-e001/WebContent/index.html a/ jweb-e001/WebContent/index.html new file mode 100644 index 0000000..90bb8d3 --- /dev/null +++ a/ jweb-e001/WebContent/index.html @@ -0,0 +1,13 @@ + + + + + Menu principal + + +

Menu principal

+ Agenda

+ Conversor de temperaturas

+ Mostrar carta poker

+ + \ No newline at end of file diff --git b/ jweb-e001/_classpath.xml a/ jweb-e001/_classpath.xml new file mode 100644 index 0000000..da1a48b --- /dev/null +++ a/ jweb-e001/_classpath.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git b/ jweb-e001/_project.xml a/ jweb-e001/_project.xml new file mode 100644 index 0000000..389fd36 --- /dev/null +++ a/ jweb-e001/_project.xml @@ -0,0 +1,38 @@ + + + jweb-e001 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.jsdt.core.jsNature + + + + WebContent/cartas + 2 + /home/hugo/eclipse-workspace/ jweb-e001/WebContent/cartas + + + diff --git b/ jweb-e001/build/classes/conversor_temperatura.class a/ jweb-e001/build/classes/conversor_temperatura.class new file mode 100644 index 0000000..0fcf84e Binary files /dev/null and a/ jweb-e001/build/classes/conversor_temperatura.class differ diff --git b/ jweb-e001/build/classes/dibujo_carta.class a/ jweb-e001/build/classes/dibujo_carta.class new file mode 100644 index 0000000..7c3d035 Binary files /dev/null and a/ jweb-e001/build/classes/dibujo_carta.class differ diff --git b/ jweb-e001/build/classes/guardar.class a/ jweb-e001/build/classes/guardar.class new file mode 100644 index 0000000..5023bcd Binary files /dev/null and a/ jweb-e001/build/classes/guardar.class differ diff --git b/ jweb-e001/src/conversor_temperatura.java a/ jweb-e001/src/conversor_temperatura.java new file mode 100644 index 0000000..9f0c1b1 --- /dev/null +++ a/ jweb-e001/src/conversor_temperatura.java @@ -0,0 +1,134 @@ + + +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 conversor_temperatura + */ +@WebServlet("/conversor_temperatura") +public class conversor_temperatura extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public conversor_temperatura() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + response.getWriter().append("Served at: ").append(request.getContextPath()); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter escribir = response.getWriter(); + try { + double fahrenheit; + double celsius; + double kelvin; + double entrada = Double.parseDouble(request.getParameter("P1")); + double selector = Double.parseDouble(request.getParameter("P0")); + if(selector == 0) { + //Esto es si la temperatura esta en celsius + celsius = entrada; + fahrenheit = (entrada * 9/5) + 32; + kelvin = entrada + 273.15; + escribir.append( + "\n" + + "\n" + + "\n" + + " \n" + + " Resultado temperaturas\n" + + " \n" + + "\n" + + "

Los resultados son

\n" + + "

Celsius: "+celsius+"

\n" + + "

Fahrenheit: "+fahrenheit+"

\n" + + "

Kelvin: "+kelvin+"



\n" + + "Volver al conversor de temperaturas

" + + "Volver al menu principal

" + + "\n" + + "" + ); + }else if(selector == 1) { + //Esto es si la temperatura esta en fahrenheit + celsius = (entrada - 32) * 5/9; + fahrenheit = entrada; + kelvin =((entrada - 32)*5/9) + 273.15; + escribir.append( + "\n" + + "\n" + + "\n" + + " \n" + + " Resultado temperaturas\n" + + " \n" + + "\n" + + "

Los resultados son

\n" + + "

Celsius: "+celsius+"

\n" + + "

Fahrenheit: "+fahrenheit+"

\n" + + "

Kelvin: "+kelvin+"



\n" + + "Volver al conversor de temperaturas

" + + "Volver al menu principal

" + + "\n" + + "" + ); + }else if(selector == 2) { + //Esto es si la temperatura esta en kelvin + celsius = entrada - 273.15; + fahrenheit = ((entrada - 273.15)*9/5)+32; + kelvin =entrada; + escribir.append( + "\n" + + "\n" + + "\n" + + " \n" + + " Resultado temperaturas\n" + + " \n" + + "\n" + + "

Los resultados son:

\n" + + "

Celsius: "+celsius+"

\n" + + "

Fahrenheit: "+fahrenheit+"

\n" + + "

Kelvin: "+kelvin+"



\n" + + "Volver al conversor de temperaturas

" + + "Volver al menu principal

" + + "\n" + + "" + ); + } + }catch(Exception e) { + escribir.append( + "\n" + + "\n" + + "\n" + + " \n" + + " Resultado temperaturas\n" + + " \n" + + "\n" + + "

Los resultados son:

\n" + + "

La entrada solo admite numeros

\n" + + "Volver al conversor de temperaturas

" + + "Volver al menu principal

" + + "\n" + + "" + ); + } + + + } + +} diff --git b/ jweb-e001/src/dibujo_carta.java a/ jweb-e001/src/dibujo_carta.java new file mode 100644 index 0000000..e0c4048 --- /dev/null +++ a/ jweb-e001/src/dibujo_carta.java @@ -0,0 +1,112 @@ + + +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" + + "Agenda\n" + + "\n" + + "\n" + + "

Tu carta es:

\n" + + " \"Resultado

\n" + + " Volver al selector de carta

" + + " Volver al menu principal" + + "\n" + + "" + ); + }else { + escribirPagina.append( + "\n" + + "\n" + + "\n" + + "\n" + + "Agenda\n" + + "\n" + + "\n" + + "

El campo valor solo admite valores entre entre el 1 y el 13



\n" + + " Volver al selector de carta

\n" + + " Volver al menu principal" + + "\n" + + "" + ); + } + }else { + escribirPagina.append( + "\n" + + "\n" + + "\n" + + "\n" + + "Agenda\n" + + "\n" + + "\n" + + "

El campo del palo solo admite valores:
* S
* H
* C
* D



\n" + + " Volver al selector de carta

\n" + + " Volver al menu principal" + + "\n" + + "" + ); + } + }catch(NumberFormatException e){ + escribirPagina.append( + "\n" + + "\n" + + "\n" + + "\n" + + "Agenda\n" + + "\n" + + "\n" + + "

El campo del valor solo admite numeros enteros



\n" + + " Volver al selector de carta

" + + " Volver al menu principal" + + "\n" + + "" + ); + } + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + doGet(request, response); + } + +} diff --git b/ jweb-e001/src/guardar.java a/ jweb-e001/src/guardar.java new file mode 100644 index 0000000..bd14010 --- /dev/null +++ a/ jweb-e001/src/guardar.java @@ -0,0 +1,98 @@ + + +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 guardar_en_agenda + */ +@WebServlet("/guardar") +public class guardar extends HttpServlet { + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public guardar() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + response.getWriter().append("Served at: ").append(request.getContextPath()); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + int contador = 1; + File carpetaClientes = new File("./lista_personas"); + if(!carpetaClientes.exists()) { + carpetaClientes.mkdir(); + } + PrintWriter escribirNavegador = response.getWriter(); + //Esto es para encontrar el archivo + String direccionArchivo = "./lista_personas/" + contador + ".txt"; + File archivo = new File(direccionArchivo); + while(archivo.isFile()) { + direccionArchivo = "./lista_personas/" + contador + ".txt"; + archivo = new File(direccionArchivo); + contador = contador + 1; + } + //Creamos el archivo + archivo.createNewFile(); + try { + //Preparamos los datos + PrintWriter escribirArchivo = new PrintWriter(archivo); + String nombre = request.getParameter("P0"); + String correo = request.getParameter("P1"); + String telefono = request.getParameter("P3"); + String direccion = request.getParameter("P4"); + nombre = nombre.toUpperCase(); + //cargamos el archivo + escribirArchivo.println(nombre + " " + correo + " " + telefono + " "+direccion); + escribirArchivo.close(); + escribirNavegador.append( + "\n" + + "\n" + + "\n" + + " \n" + + " Log guardado\n" + + " \n" + + "\n" + + "

Los datos se cargaron correctamente



\n" + + " Cargar una nueva persona

" + + " Volver al menu principal" + + "\n" + + "" + ); + }catch (Exception e) { + escribirNavegador.append("\n" + + "\n" + + "\n" + + " \n" + + " Log guardado\n" + + " \n" + + "\n" + + "

"+ e.getMessage()+"



\n" + + " Volver a cargar a la persona

" + + " Volver al menu principal" + + "\n" + + "" + ); + } + } + +} diff --git b/Readme.md a/Readme.md new file mode 100644 index 0000000..2b5e546 --- /dev/null +++ a/Readme.md @@ -0,0 +1,15 @@ +# A tomar en cuenta + +1. Los enlaces son los siguientes: + - Cartas: localhost:8080/_jweb-e001/cartas.html + - Convertidor de temperaturas: http://localhost:8080/_jweb-e001/conversor.html + - Agenda: http://localhost:8080/_jweb-e001/agenda.html + - Pagina principal: http://localhost:8080/_jweb-e001/index.html + +2. Los archivos generados en agenda son almacenadas en la carpeta "lista_personas", y la misma se genera donde se ejecuta el servidor apache, es decir, en mi caso, se crea la carpeta y se crea los archivos en la carpeta de la aplicación de eclipse, que tiene la direccion, en mi caso: /home/hugo/Eclipse-2018-09/eclipse/lista_personas + +3. Las imagenes de las cartas estan almacenadas en el "WebContent", en la carpeta "cartas". + +4. La carpeta 'jweb-e001' contiene el proyecto, y se hizo con la aplicacion eclipse. + + diff --git b/jweb-e001.war a/jweb-e001.war new file mode 100644 index 0000000..d580987 Binary files /dev/null and a/jweb-e001.war differ