Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions 9 .idea/JavaWebApplicationExample.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions 12 src/main/java/ejemplos/servlet/curso/MyServlet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ejemplos.servlet.curso;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
Expand All @@ -18,13 +19,10 @@ protected void doGet(HttpServletRequest request,
PrintWriter out = response.getWriter();

// send HTML page to client
out.println("<html>");
out.println("<head><title>Ejemplo HTML desde Servlet</title></head>");
out.println("<body>");
out.println("<h1>Ejemplo Servlet</h1>");
out.println("<p>Este es un ejemplo en el curso de Java para generar HTML desde un Servlet.</p>");
out.println("<p><a href=\"/myServlet2\">Vamos al otro Servlet</a></p>");
out.println("</body></html>");
//MyObject obj = ... //build somehow
//request.setAttribute("myObject", obj);
RequestDispatcher rd = request.getRequestDispatcher("WEB-INF/jsp/formulario.jsp");
rd.forward(request, response);
}

}
9 changes: 5 additions & 4 deletions 9 src/main/java/ejemplos/servlet/curso/MyServlet2.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ejemplos.servlet.curso;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
Expand All @@ -18,10 +19,10 @@ protected void doGet(HttpServletRequest request,
PrintWriter out = response.getWriter();

// send HTML page to client
out.println("<html>");
out.println("<head><title>Ejemplo HTML desde Servlet</title></head>");
out.println("<body>");
out.println("<h1>Bienvenido!!</h1>");
//MyObject obj = ... //build somehow
request.setAttribute("valueFname", request.getParameter("fname"));
RequestDispatcher rd = request.getRequestDispatcher("WEB-INF/jsp/saludo.jsp");
rd.forward(request, response);
}

}
14 changes: 14 additions & 0 deletions 14 src/main/webapp/WEB-INF/jsp/formulario.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<html>
<head>
<title>Servlet formulario saludo v1.3</title>
<link rel="stylesheet" href="css/style.css" type="text/css"></link>
</head>
<body>
<h1>Ejemplo Servlet</h1>
<form action="/myServlet2">
<label for="fname">Nombre:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
9 changes: 9 additions & 0 deletions 9 src/main/webapp/WEB-INF/jsp/saludo.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<title>Pagina de saludo v1.3</title>
<link rel="stylesheet" href="css/style.css" type="text/css"></link>
</head>
<body>
<h1>Bienvenido/a ${valueFname} !! </h1>
</body>
</html>
75 changes: 75 additions & 0 deletions 75 src/main/webapp/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #eceffc;
}

.btn {
padding: 8px 20px;
border-radius: 0;
overflow: hidden;

&::before {
position: absolute;
content: "";
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(
120deg,
transparent,
var(--primary-color),
transparent
);
transform: translateX(-100%);
transition: 0.6s;
}

&:hover {
background: transparent;
box-shadow: 0 0 20px 10px hsla(204, 70%, 53%, 0.5);

&::before {\
transform: translateX(100%);
}
}
}

.form-input-material {
--input-default-border-color: white;
--input-border-bottom-color: white;

input {
color: white;
}
}

.login-form {
display: flex;
flex-direction: column;
align-items: center;
padding: 50px 40px;
color: white;
background: rgba(0, 0, 0, 0.8);
border-radius: 10px;
box-shadow: 0 0.4px 0.4px rgba(128, 128, 128, 0.109),
0 1px 1px rgba(128, 128, 128, 0.155),
0 2.1px 2.1px rgba(128, 128, 128, 0.195),
0 4.4px 4.4px rgba(128, 128, 128, 0.241),
0 12px 12px rgba(128, 128, 128, 0.35);

h1 {
margin: 0 0 24px 0;
}

.form-input-material {
margin: 12px 0;
}
.btn {
width: 100%;
margin: 18px 0 9px 0;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.