Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jweb-e002
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cristian Caceres
jweb-e002
Commits
67e8785b
Commit
67e8785b
authored
Aug 21, 2019
by
Cristian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inicila proyect
parent
122c52ea
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
321 additions
and
25 deletions
+321
-25
WebContent/AgendaResultado.jsp
+75
-0
WebContent/ConversorResultado.jsp
+6
-3
WebContent/Error.jsp
+45
-0
WebContent/ResultadoCarta.jsp
+1
-1
WebContent/agenda.html
+30
-1
WebContent/cartas.html
+10
-10
WebContent/conversor.html
+2
-2
src/servlet/AgendaServlet.java
+92
-0
src/servlet/Carta.java
+2
-2
src/servlet/ConversorServlet.java
+58
-6
No files found.
WebContent/AgendaResultado.jsp
0 → 100644
View file @
67e8785b
<
%@
page
language=
"java"
contentType=
"text/html; charset=ISO-8859-1"
pageEncoding=
"ISO-8859-1"
%
>
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"ISO-8859-1"
>
<title>
Agenda
</title>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
</head>
<body
class=
"container"
>
<br>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
<div
class=
"collapse navbar-collapse"
id=
"navbarSupportedContent"
>
<ul
class=
"navbar-nav mr-auto"
>
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
href=
"/jweb-e002/index.html"
>
Inicio
<span
class=
"sr-only"
>
(current)
</span></a>
</li>
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
href=
"/jweb-e002/conversor.html"
>
Conversor
<span
class=
"sr-only"
>
(current)
</span></a>
</li>
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
href=
"/jweb-e002/agenda.html"
>
Agenda
<span
class=
"sr-only"
>
(current)
</span></a>
</li>
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
href=
"/jweb-e002/cartas.html"
>
Cartas de Poker
<span
class=
"sr-only"
>
(current)
</span></a>
</li>
</div>
</nav>
<div
>
<form
action=
"guardar"
method=
"POST"
>
<br>
<div
class=
"form-group"
>
<label
for=
"nombre"
>
Nombre
</label>
<input
type=
"text"
class=
"form-control"
id=
"nombre"
name=
"nombre"
placeholder=
"Ej. Cristian"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"correo"
>
Correo Electronico
</label>
<input
type=
"email"
class=
"form-control"
id=
"corro"
name=
"correo_electronico"
placeholder=
"Ej. snape727@gmail.com"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"telefono"
>
Telefono
</label>
<input
type=
"text"
class=
"form-control"
id=
"telefono"
name=
"telefono"
placeholder=
"Ej. 0982160609"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"direccion"
>
Direccin
</label>
<input
type=
"text"
class=
"form-control"
id=
"direccion"
name=
"direccion"
placeholder=
"Ejemplo Avda Mariscal Lopez"
required
>
</div>
<div
class=
"d-flex"
>
<button
type=
"submit"
class=
"btn btn-dark btn-sm ml-auto "
>
Guardar
</button>
</div>
</form>
</div>
</body>
<
%
if
(
request
.
getAttribute
("
resultado
")!=
null
)
{%
>
<script>
alert
(
"se creo correctamente"
)
</script>
<
%};%
>
</html>
\ No newline at end of file
WebContent/ConversorResultado.jsp
View file @
67e8785b
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
</head>
</head>
<body>
<body
class=
"container"
>
<
%
ArrayList
<
Float
>
resultado=(ArrayList
<Float>
) request.getAttribute("resultado");
<
%
ArrayList
<
Float
>
resultado=(ArrayList
<Float>
) request.getAttribute("resultado");
...
@@ -23,7 +23,6 @@ if(tipo.toLowerCase().equals("c")){
...
@@ -23,7 +23,6 @@ if(tipo.toLowerCase().equals("c")){
}
}
%>
%>
</body>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
...
@@ -49,7 +48,7 @@ if(tipo.toLowerCase().equals("c")){
...
@@ -49,7 +48,7 @@ if(tipo.toLowerCase().equals("c")){
</nav>
</nav>
<div
class=
"container"
>
<div
>
<br>
<br>
<div
class=
"form-group row"
>
<div
class=
"form-group row"
>
...
@@ -83,4 +82,7 @@ if(tipo.toLowerCase().equals("c")){
...
@@ -83,4 +82,7 @@ if(tipo.toLowerCase().equals("c")){
</div>
</div>
</div>
</div>
</div>
</body>
</html>
</html>
\ No newline at end of file
WebContent/Error.jsp
0 → 100644
View file @
67e8785b
<
%@
page
language=
"java"
contentType=
"text/html; charset=ISO-8859-1"
pageEncoding=
"ISO-8859-1"
%
>
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"ISO-8859-1"
>
<title>
Error
</title>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
</head>
<body>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
<div
class=
"collapse navbar-collapse"
id=
"navbarSupportedContent"
>
<ul
class=
"navbar-nav mr-auto"
>
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
href=
"/jweb-e002/index.html"
>
Inicio
<span
class=
"sr-only"
>
(current)
</span></a>
</li>
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
href=
"/jweb-e002/conversor.html"
>
Conversor
<span
class=
"sr-only"
>
(current)
</span></a>
</li>
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
href=
"/jweb-e002/agenda.html"
>
Agenda
<span
class=
"sr-only"
>
(current)
</span></a>
</li>
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
href=
"/jweb-e002/cartas.html"
>
Cartas de Poker
<span
class=
"sr-only"
>
(current)
</span></a>
</li>
</div>
</nav>
</body
class="container"
>
<
%
Exception
resultado=
null;
if
(
request
.
getAttribute
("
resultado
")!=
null
){
resultado=
(Exception)
request
.
getAttribute
("
resultado
");
}
%
>
<h1><
%=
resultado
.
toString
()
%
></h1>
</html>
\ No newline at end of file
WebContent/ResultadoCarta.jsp
View file @
67e8785b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<meta
charset=
"ISO-8859-1"
>
<meta
charset=
"ISO-8859-1"
>
<title>
Resultado Carta
</title>
<title>
Resultado Carta
</title>
</head>
</head>
<body>
<body
class=
"container"
>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
...
...
WebContent/agenda.html
View file @
67e8785b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
crossorigin=
"anonymous"
>
</head>
</head>
<body>
<body
class=
"container"
>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
...
@@ -31,5 +31,33 @@
...
@@ -31,5 +31,33 @@
</li>
</li>
</div>
</div>
</nav>
</nav>
<div
>
<form
action=
"guardar"
method=
"POST"
>
<br>
<div
class=
"form-group"
>
<label
for=
"nombre"
>
Nombre
</label>
<input
type=
"text"
class=
"form-control"
id=
"nombre"
name=
"nombre"
placeholder=
"Ej. Cristian"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"correo"
>
Correo Electronico
</label>
<input
type=
"email"
class=
"form-control"
id=
"corro"
name=
"correo_electronico"
placeholder=
"Ej. snape727@gmail.com"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"telefono"
>
Telefono
</label>
<input
type=
"text"
class=
"form-control"
id=
"telefono"
name=
"telefono"
placeholder=
"Ej. 0982160609"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"direccion"
>
Direccin
</label>
<input
type=
"text"
class=
"form-control"
id=
"direccion"
name=
"direccion"
placeholder=
"Ejemplo Avda Mariscal Lopez"
required
>
</div>
<div
class=
"d-flex"
>
<button
type=
"submit"
class=
"btn btn-dark btn-sm ml-auto "
>
Guardar
</button>
</div>
</form>
</div>
</body>
</body>
</html>
</html>
\ No newline at end of file
WebContent/cartas.html
View file @
67e8785b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
crossorigin=
"anonymous"
>
</head>
</head>
<body>
<body
class=
"container"
>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
...
@@ -31,27 +31,27 @@
...
@@ -31,27 +31,27 @@
</li>
</li>
</div>
</div>
</nav>
</nav>
<div
class=
"container"
>
<div
>
<form
action=
"dibujo_carta"
method=
"GET"
>
<form
action=
"dibujo_carta"
method=
"GET"
>
<br>
<br>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<div
class=
"input-group mb-3"
>
<div
class=
"input-group mb-3"
>
<div
class=
"input-group-prepend"
>
<div
class=
"input-group-prepend"
>
<label
class=
"input-group-text"
for=
"inputGroupSelect01"
>
Palo
</label>
<label
class=
"input-group-text"
for=
"inputGroupSelect01"
>
Palo
s posibles: S,C,H,D
</label>
</div>
</div>
<select
name=
"
P0"
required
class=
"custom-select"
id=
"P0
"
>
<select
name=
"
palo"
required
class=
"custom-select"
id=
"palo
"
>
<option
value=
""
>
Escoge...
</option>
<option
value=
""
>
Escoge...
</option>
<option
value=
"
C
"
>
S
</option>
<option
value=
"
S
"
>
S
</option>
<option
value=
"
F
"
>
C
</option>
<option
value=
"
C
"
>
C
</option>
<option
value=
"
K
"
>
H
</option>
<option
value=
"
H
"
>
H
</option>
<option
value=
"
K
"
>
D
</option>
<option
value=
"
D
"
>
D
</option>
</select>
</select>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"tarea"
>
Valor
</label>
<label
for=
"tarea"
>
Valor
es posibles: A,2,3,4,5,6,7,8,9,T,J,Q,K
</label>
<input
type=
"
number"
class=
"form-control"
id=
"P1"
name=
"P1"
placeholder=
"Valor en Digitos"
required
minlength=
"1"
maxlength=
"2
"
>
<input
type=
"
text"
class=
"form-control"
required
pattern=
"A|a|A|A|3|4|5|6|7|8|9|T|t|j|J|q|Q|K|k"
title=
"Valores posibles: A,2,3,4,5,6,7,8,9,T,J,Q,K"
id=
"valor"
name=
"valor"
placeholder=
"Valores posibles: A,2,3,4,5,6,7,8,9,T,J,Q,K"
required
maxlength=
"1
"
>
</div>
</div>
<div
class=
"d-flex"
>
<div
class=
"d-flex"
>
...
...
WebContent/conversor.html
View file @
67e8785b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
</head>
</head>
<body>
<body
class=
"container"
>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<a
class=
"navbar-brand"
href=
"#"
>
Menu
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
</div>
</div>
</nav>
</nav>
<div
class=
"container"
>
<div
>
<form
action=
"ConversorServlet"
method=
"POST"
>
<form
action=
"ConversorServlet"
method=
"POST"
>
<br>
<br>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
...
...
src/servlet/AgendaServlet.java
0 → 100644
View file @
67e8785b
package
servlet
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
javax.servlet.RequestDispatcher
;
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 AgendaServlet
*/
@WebServlet
(
"/guardar"
)
public
class
AgendaServlet
extends
HttpServlet
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* @see HttpServlet#HttpServlet()
*/
public
AgendaServlet
()
{
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
{
// TODO Auto-generated method stub
doGet
(
request
,
response
);
int
numeracionArchivo
=
1
;
String
ruta
;
File
archivo
;
BufferedWriter
bw
;
do
{
ruta
=
getServletContext
().
getRealPath
(
"/"
+
numeracionArchivo
+
".txt"
);
archivo
=
new
File
(
ruta
);
if
(!
archivo
.
exists
())
{
System
.
out
.
println
(
"Se crea el archivo "
+
numeracionArchivo
+
".txt"
);
break
;
}
numeracionArchivo
++;
}
while
(
true
);
archivo
.
createNewFile
();
bw
=
new
BufferedWriter
(
new
FileWriter
(
archivo
));
String
nombre
=
request
.
getParameter
(
"nombre"
);
String
correoElectronico
=
request
.
getParameter
(
"correo_electronico"
);
String
telefono
=
request
.
getParameter
(
"telefono"
);
String
direccion
=
request
.
getParameter
(
"direccion"
);
System
.
out
.
println
(
nombre
);
System
.
out
.
println
(
correoElectronico
);
System
.
out
.
println
(
telefono
);
System
.
out
.
println
(
direccion
);
bw
.
write
(
nombre
+
" "
+
"\n"
);
bw
.
write
(
correoElectronico
+
" "
+
"\n"
);
bw
.
write
(
telefono
+
" "
+
"\n"
);
bw
.
write
(
direccion
+
" "
+
"\n"
);
bw
.
close
();
request
.
setAttribute
(
"resultado"
,
"correcto"
);
RequestDispatcher
rd
=
request
.
getRequestDispatcher
(
"/AgendaResultado.jsp"
);
if
(
rd
!=
null
)
{
rd
.
forward
(
request
,
response
);
}
}
}
src/servlet/Carta.java
View file @
67e8785b
...
@@ -31,8 +31,8 @@ public class Carta extends HttpServlet {
...
@@ -31,8 +31,8 @@ public class Carta extends HttpServlet {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
//response.getWriter().append("Served at: ").append(request.getContextPath());
//response.getWriter().append("Served at: ").append(request.getContextPath());
String
palo
=
request
.
getParameter
(
"
P0
"
).
toUpperCase
();
String
palo
=
request
.
getParameter
(
"
palo
"
).
toUpperCase
();
String
valor
=
request
.
getParameter
(
"
P1
"
).
toUpperCase
();
String
valor
=
request
.
getParameter
(
"
valor
"
).
toUpperCase
();
String
rutaImagen
=
"imagenes/"
+
valor
+
palo
+
".png"
;
String
rutaImagen
=
"imagenes/"
+
valor
+
palo
+
".png"
;
System
.
out
.
println
(
rutaImagen
);
System
.
out
.
println
(
rutaImagen
);
...
...
src/servlet/ConversorServlet.java
View file @
67e8785b
package
servlet
;
package
servlet
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
javax.servlet.RequestDispatcher
;
import
javax.servlet.RequestDispatcher
;
...
@@ -39,28 +40,79 @@ public class ConversorServlet extends HttpServlet {
...
@@ -39,28 +40,79 @@ public class ConversorServlet extends HttpServlet {
protected
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
protected
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
doGet
(
request
,
response
);
doGet
(
request
,
response
);
ArrayList
<
Float
>
resultado
=
new
ArrayList
<
Float
>();
System
.
out
.
println
(
request
.
getParameter
(
"P0"
).
toString
());
System
.
out
.
println
(
Float
.
parseFloat
(
request
.
getParameter
(
"P1"
)));
try
{
try
{
ArrayList
<
Float
>
resultado
=
convertidor
(
request
.
getParameter
(
"P0"
).
toString
(),
Float
.
parseFloat
(
request
.
getParameter
(
"P1"
)));
if
(
request
.
getParameter
(
"P1"
)!=
null
&&
request
.
getParameter
(
"P0"
)!=
null
)
{
System
.
out
.
println
(
request
.
getParameter
(
"P0"
).
toString
());
String
p0
=
request
.
getParameter
(
"P0"
).
toString
();
if
(!
"c"
.
equals
(
p0
)||
!
"k"
.
equals
(
p0
)||
!
"f"
.
equals
(
p0
))
{
request
.
setAttribute
(
"resultado"
,
"valor de palo no esperado"
);
RequestDispatcher
rd
=
request
.
getRequestDispatcher
(
"Error.jsp"
);
if
(
rd
!=
null
)
{
rd
.
forward
(
request
,
response
);
}
}
resultado
=
convertidor
(
request
.
getParameter
(
"P0"
).
toString
(),
Float
.
parseFloat
(
request
.
getParameter
(
"P1"
)));
System
.
out
.
println
(
"aca llego"
);
System
.
out
.
println
(
"aca llego"
);
request
.
setAttribute
(
"P0"
,
request
.
getParameter
(
"P0"
));
request
.
setAttribute
(
"P0"
,
request
.
getParameter
(
"P0"
));
request
.
setAttribute
(
"P1"
,
request
.
getParameter
(
"P"
));
request
.
setAttribute
(
"P1"
,
request
.
getParameter
(
"P
1
"
));
request
.
setAttribute
(
"resultado"
,
resultado
);
request
.
setAttribute
(
"resultado"
,
resultado
);
}
else
{
request
.
setAttribute
(
"resultado"
,
"Parametros nulos"
);
RequestDispatcher
rd
=
request
.
getRequestDispatcher
(
"Error.jsp"
);
if
(
rd
!=
null
)
{
rd
.
forward
(
request
,
response
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// TODO: handle exception
// TODO: handle exception
System
.
out
.
println
(
"exploto"
);
request
.
setAttribute
(
"resultado"
,
"el valor no es numerico"
);
RequestDispatcher
rd
=
request
.
getRequestDispatcher
(
"Error.jsp"
);
RequestDispatcher
rd
=
request
.
getRequestDispatcher
(
"Error.jsp"
);
if
(
rd
!=
null
)
{
if
(
rd
!=
null
)
{
rd
.
forward
(
request
,
response
);
rd
.
forward
(
request
,
response
);
}
}
}
/*PrintWriter respuesta= response.getWriter();
respuesta.println("<!DOCTYPE html>");
respuesta.print("<html>");
respuesta.println("<head>");
respuesta.println("<meta charset=\"UTF-8\">");
respuesta.println("<title>Convertidor!</title>");
respuesta.println("</head>");
respuesta.println("<body>");
respuesta.println("El valor introducido no es valido" );
respuesta.println("</body>");
respuesta.println("</html>");
return;*/
}
finally
{
RequestDispatcher
rd
=
request
.
getRequestDispatcher
(
"/ConversorResultado.jsp"
);
RequestDispatcher
rd
=
request
.
getRequestDispatcher
(
"/ConversorResultado.jsp"
);
if
(
rd
!=
null
)
{
if
(
rd
!=
null
)
{
rd
.
forward
(
request
,
response
);
rd
.
forward
(
request
,
response
);
}
}
PrintWriter
respuesta
=
response
.
getWriter
();
respuesta
.
println
(
"<!DOCTYPE html>"
);
respuesta
.
print
(
"<html>"
);
respuesta
.
println
(
"<head>"
);
respuesta
.
println
(
"<meta charset=\"UTF-8\">"
);
respuesta
.
println
(
"<title>Convertidor!</title>"
);
respuesta
.
println
(
"</head>"
);
respuesta
.
println
(
"<body>"
);
respuesta
.
println
(
"En grados Celsius: "
+
resultado
.
get
(
0
)
);
respuesta
.
println
(
"<br>"
);
respuesta
.
println
(
"En grados Fharenheit: "
+
resultado
.
get
(
1
));
respuesta
.
println
(
"<br>"
);
respuesta
.
println
(
"En grados kelvin: "
+
resultado
.
get
(
2
));
respuesta
.
println
(
"</body>"
);
respuesta
.
println
(
"</html>"
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment