Commit 122c52ea by Cristian

inicial

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_201">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v9.0">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>jweb-e002</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="jweb-e002">
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<property name="context-root" value="jweb-e002"/>
<property name="java-output-path" value="/jweb-e002/build/classes"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v9.0"/>
<fixed facet="java"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="4.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Window
\ No newline at end of file
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Resultado Conversor</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>
<% ArrayList<Float>resultado=(ArrayList<Float>) request.getAttribute("resultado");
String tipo =request.getAttribute("P0").toString();
if(tipo.toLowerCase().equals("c")){
tipo=" Celsius";
}else if(tipo.toLowerCase().equals("f")){
tipo=" Fahrenheit";
}else{
tipo=" Kelvin";
}
%>
</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>
<div class="container">
<br>
<div class="form-group row">
<label for="staticEmail" class="col-sm-2 col-form-label">De Tipo Temperatura</label>
<div class="col-sm-10">
<input type="text" readonly class="form-control-plaintext" id="tipo" value="<%=tipo%>">
</div>
</div>
<div class="form-group">
<label for="tarea">Temperatura</label>
<input type="number" class="form-control" id="P1" name="P1" placeholder="Temperatura en digitos" value="<%=request.getAttribute("P1").toString() %>" required disabled>
</div>
<div class="form-group row">
<label for="staticEmail" class="col-sm-2 col-form-label"> a Celsius</label>
<div class="col-sm-10">
<input type="text" readonly class="form-control-plaintext" id="tipo" value="<%=resultado.get(0).toString()+" C" %>">
</div>
</div>
<div class="form-group row">
<label for="staticEmail" class="col-sm-2 col-form-label">a Fahrenheit</label>
<div class="col-sm-10">
<input type="text" readonly class="form-control-plaintext" id="tipo" value="<%=resultado.get(1).toString()+" F" %>">
</div>
</div>
<div class="form-group row">
<label for="staticEmail" class="col-sm-2 col-form-label"> a Kelvin</label>
<div class="col-sm-10">
<input type="text" readonly class="form-control-plaintext" id="tipo" value="<%=resultado.get(2).toString()+" K" %>">
</div>
</div>
</html>
\ No newline at end of file
Manifest-Version: 1.0
Class-Path:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<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">
<meta charset="ISO-8859-1">
<title>Resultado Carta</title>
</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>
<img src= "<%=request.getAttribute("rutaImagen") %>" width=200 height=250 >
</body>
</html>
\ No newline at end of file
<!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>
<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>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Cartas</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>
<div class="container">
<form action="dibujo_carta" method="GET">
<br>
<div class="form-group">
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="inputGroupSelect01">Palo</label>
</div>
<select name="P0" required class="custom-select" id="P0" >
<option value="">Escoge...</option>
<option value="C">S</option>
<option value="F">C</option>
<option value="K">H</option>
<option value="K">D</option>
</select>
</div>
</div>
<div class="form-group">
<label for="tarea">Valor</label>
<input type="number" class="form-control" id="P1" name="P1" placeholder="Valor en Digitos" required minlength="1" maxlength="2" >
</div>
<div class="d-flex">
<button type="submit" class="btn btn-dark btn-sm ml-auto ">Guardar</button>
</div>
</form>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Conversor</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>
<div class="container">
<form action="ConversorServlet" method="POST">
<br>
<div class="form-group">
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="inputGroupSelect01">Tipo Temperatura</label>
</div>
<select name="P0" required class="custom-select" id="P0" >
<option value="">Escoge...</option>
<option value="C">Celsius</option>
<option value="F">Farenheit</option>
<option value="K">Kelvin</option>
</select>
</div>
</div>
<div class="form-group">
<label for="tarea">Temperatura</label>
<input type="number" class="form-control" id="P1" name="P1" placeholder="Temperatura en digitos" required>
</div>
<div class="d-flex">
<button type="submit" class="btn btn-dark btn-sm ml-auto ">Guardar</button>
</div>
</form>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Inicio</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">
<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>
</html>
\ No newline at end of file
package servlet;
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 Carta
*/
@WebServlet("/dibujo_carta")
public class Carta extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Carta() {
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());
String palo = request.getParameter("P0").toUpperCase();
String valor = request.getParameter("P1").toUpperCase();
String rutaImagen = "imagenes/"+valor+palo+".png";
System.out.println(rutaImagen);
request.setAttribute("rutaImagen", rutaImagen);
RequestDispatcher rd = getServletContext().getRequestDispatcher("/ResultadoCarta.jsp");
rd.forward(request, response);
}
/**
* @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);
}
}
package servlet;
import java.io.IOException;
import java.util.ArrayList;
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 ConversorServlet
*/
@WebServlet("/ConversorServlet")
public class ConversorServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ConversorServlet() {
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);
System.out.println(request.getParameter("P0").toString());
System.out.println(Float.parseFloat(request.getParameter("P1")));
try {
ArrayList<Float>resultado = convertidor(request.getParameter("P0").toString(),Float.parseFloat(request.getParameter("P1")));
System.out.println("aca llego");
request.setAttribute("P0", request.getParameter("P0"));
request.setAttribute("P1", request.getParameter("P"));
request.setAttribute("resultado", resultado);
} catch (Exception e) {
// TODO: handle exception
RequestDispatcher rd = request.getRequestDispatcher("Error.jsp");
if (rd != null) {
rd.forward(request, response);
}
}
RequestDispatcher rd = request.getRequestDispatcher("/ConversorResultado.jsp");
if (rd != null) {
rd.forward(request, response);
}
}
protected ArrayList<Float> convertidor(String tipo_temperatura, Float temperatura) {
ArrayList<Float> resultado= new ArrayList<Float>();
resultado.add((float) 0);
resultado.add((float) 0);
resultado.add((float) 0);
if(tipo_temperatura.toLowerCase().equals("c") ) {
resultado.clear();
resultado.add(temperatura);
resultado.add((float) ((temperatura * 9/5) + 32));
resultado.add((float) (temperatura + 273.15));
}
if(tipo_temperatura.toLowerCase().equals("f")) {
resultado.clear();
resultado.add((float)((temperatura - 32) * 5/9));
resultado.add(temperatura);
resultado.add((float)((temperatura - 32) * 5/9 + 273.15 ));
}
if(tipo_temperatura.toLowerCase().equals("k")) {
resultado.clear();
resultado.add((float)(temperatura - 273.15));
resultado.add((float)((temperatura - 273.15) * 9/5 + 32));
resultado.add(temperatura);
}
for(Float item: resultado) {
System.out.println("asdasdasd");
System.out.println(item);
}
return resultado;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment