Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
servlets
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
Oscar Enrique Gonzalez Escurra
servlets
Commits
6703c9ff
Commit
6703c9ff
authored
Jun 29, 2022
by
OscarGonzalez97
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
se agregan ejemplos JSP
parent
808c1385
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
0 deletions
+152
-0
src/main/java/com/roshka/bootcamp/MVC/Controller.java
+23
-0
src/main/java/com/roshka/bootcamp/UserController.java
+33
-0
src/main/java/com/roshka/bootcamp/bean/User.java
+41
-0
src/main/webapp/addition.jsp
+18
-0
src/main/webapp/ejemploEL.jsp
+21
-0
src/main/webapp/numbers.html
+16
-0
No files found.
src/main/java/com/roshka/bootcamp/MVC/Controller.java
0 → 100644
View file @
6703c9ff
package
com
.
roshka
.
bootcamp
.
MVC
;
import
jakarta.servlet.ServletException
;
import
jakarta.servlet.annotation.WebServlet
;
import
jakarta.servlet.http.HttpServlet
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
@WebServlet
(
"/mvc"
)
public
class
Controller
extends
HttpServlet
{
@Override
public
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
String
url
=
"/index.html"
;
}
}
src/main/java/com/roshka/bootcamp/UserController.java
0 → 100644
View file @
6703c9ff
package
com
.
roshka
.
bootcamp
;
import
com.roshka.bootcamp.bean.User
;
import
jakarta.servlet.ServletException
;
import
jakarta.servlet.annotation.WebServlet
;
import
jakarta.servlet.http.HttpServlet
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
@WebServlet
(
"/introJSP"
)
public
class
UserController
extends
HttpServlet
{
@Override
public
void
doGet
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
User
user
=
new
User
();
user
.
setNombre
(
"Oscar"
);
user
.
setApellido
(
"Gonzalez"
);
user
.
setEmail
(
"ogonzalez@roshka.com"
);
request
.
setAttribute
(
"usuario"
,
user
);
getServletContext
()
.
getRequestDispatcher
(
"/ejemploEL.jsp"
)
.
forward
(
request
,
response
);
}
}
src/main/java/com/roshka/bootcamp/bean/User.java
0 → 100644
View file @
6703c9ff
package
com
.
roshka
.
bootcamp
.
bean
;
import
java.io.Serializable
;
public
class
User
implements
Serializable
{
private
String
nombre
;
private
String
apellido
;
private
String
email
;
// getters y setters
public
String
getNombre
()
{
return
nombre
;
}
public
void
setNombre
(
String
nombre
)
{
this
.
nombre
=
nombre
;
}
public
String
getApellido
()
{
return
apellido
;
}
public
void
setApellido
(
String
apellido
)
{
this
.
apellido
=
apellido
;
}
public
String
getEmail
()
{
return
email
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
// constructor
public
User
()
{
this
.
apellido
=
""
;
this
.
nombre
=
""
;
this
.
email
=
""
;
}
}
src/main/webapp/addition.jsp
0 → 100644
View file @
6703c9ff
<
%@
page
language=
"java"
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%
>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Suma de 2 numeros
</title>
</head>
<body>
<
%
int
num1 =
Integer.parseInt(
request
.
getParameter
("
number1
"));
int
num2 =
Integer.parseInt(
request
.
getParameter
("
number2
"));
%
>
La suma de
<
%=
num1
%
>
y
<
%=
num2
%
>
==
<
%=
num1
+
num2
%
>
</body>
</html>
\ No newline at end of file
src/main/webapp/ejemploEL.jsp
0 → 100644
View file @
6703c9ff
<
%@
page
language=
"java"
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%
>
<
%@
page
isELIgnored=
"false"
%
>
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Login
</title>
<link
rel=
"stylesheet"
href=
"estilos/login.css"
></link>
</head>
<body>
<h1>
Usando JSP
</h1>
<label>
Nombre:
</label>
<span>
${usuario.nombre}
</span>
<label>
Apellido:
</label>
<span>
${usuario.apellido}
</span>
<label>
Email:
</label>
<span>
${usuario.email}
</span>
</body>
</html>
\ No newline at end of file
src/main/webapp/numbers.html
0 → 100644
View file @
6703c9ff
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
Addition
</title>
</head>
<body>
<form
action=
"addition.jsp"
>
<h2>
Enter the Numbers
</h2><br/>
Number1:
<input
type=
"text"
name=
"number1"
/><br/>
Number2:
<input
type=
"text"
name=
"number2"
/><br/>
<input
type=
"submit"
name=
"submit"
/>
</form>
</body>
</html>
\ No newline at end of file
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