Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Manuel Ruiz Fernández
/
freemarker
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Merge Requests
0
Pipelines
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
743b2d19
authored
May 04, 2023
by
Francisco Javier
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
pagina de bienvenida
parent
5a3b8da6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
42 deletions
pom.xml
src/main/java/com/example/FreeMarket/FreeMarketApplication.java
src/main/java/com/example/FreeMarket/controller/SalasController.java
src/main/java/com/example/FreeMarket/model/Sala.java
src/main/resources/templates/home.ftl
src/main/resources/templates/index.ftl
pom.xml
View file @
743b2d19
...
...
@@ -38,7 +38,6 @@
<scope>
runtime
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
...
...
@@ -47,5 +46,4 @@
</plugin>
</plugins>
</build>
</project>
src/main/java/com/example/FreeMarket/FreeMarketApplication.java
View file @
743b2d19
...
...
@@ -21,6 +21,5 @@ public class FreeMarketApplication implements CommandLineRunner {
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
}
}
src/main/java/com/example/FreeMarket/controller/SalasController.java
View file @
743b2d19
...
...
@@ -7,6 +7,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.servlet.ModelAndView
;
...
...
@@ -20,18 +22,22 @@ public class SalasController {
private
SalaRepository
salaRepository
;
@GetMapping
(
"/"
)
public
String
index
(
Model
model
)
{
public
String
mostrarFormulario
(
Model
modelo
)
{
modelo
.
addAttribute
(
"titulo"
,
"Página de Bienvenida"
);
return
"bienvenida"
;
}
return
"index"
;
@PostMapping
(
"/"
)
public
String
procesarFormulario
(
@RequestParam
(
"nombre"
)
String
nombre
,
Model
modelo
)
{
modelo
.
addAttribute
(
"titulo"
,
"Página de Bienvenida"
);
modelo
.
addAttribute
(
"nombre"
,
nombre
);
return
"bienvenida"
;
}
/*@GetMapping("/")
public ModelAndView home() {
ModelAndView mv = new ModelAndView("home");
List<Sala> salas = salaRepository.findAll();
mv.addObject("salas", salas);
return mv;
}*/
@GetMapping
(
"/index"
)
public
String
index
(
Model
model
)
{
return
"index"
;
}
@GetMapping
(
"/showSalas"
)
public
ModelAndView
showCities
(){
List
<
Sala
>
salas
=
salaRepository
.
findAll
();
...
...
src/main/java/com/example/FreeMarket/model/Sala.java
View file @
743b2d19
...
...
@@ -20,6 +20,13 @@ public class Sala {
this
.
tamano
=
tamano
;
}
public
Sala
(
Sala
sala
)
{
this
.
id
=
sala
.
id
;
this
.
descripcion
=
sala
.
descripcion
;
this
.
ubicacion
=
sala
.
ubicacion
;
this
.
tamano
=
sala
.
tamano
;
}
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
public
Integer
getId
()
{
...
...
src/main/resources/templates/home.ftl
deleted
100644 → 0
View file @
5a3b8da6
<!DOCTYPE html>
<html>
<head>
<title>
Home page
</title>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
rel=
"stylesheet"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
</head>
<body>
<
#
list
salas
as
sala
>
<tr>
<td>
${sala.id}
</td>
<td>
${sala.descripcion}
</td>
<td>
${sala.ubicacion}
</td>
<td>
${sala.tamano}
</td>
</tr>
</
#
list>
</body>
</html>
\ No newline at end of file
src/main/resources/templates/index.ftl
View file @
743b2d19
...
...
@@ -8,18 +8,14 @@
rel=
"stylesheet"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
</head>
<body>
<div
class=
"container"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<h2>
Pagina de inicio
</h2>
</div>
<a
href=
"showSalas"
>
Ver Salas (Recuperar datos de salas de la base de datos.)
</a>
<br/>
<a
href=
"home"
>
home
</a>
<a
href=
"showSalas"
class=
"btn btn-outline-primary"
>
Ver Salas (Recuperar datos de salas de la base de datos.)
</a>
</div>
</div>
</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