Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FileNook
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sanblas
FileNook
Commits
a6a094bb
Commit
a6a094bb
authored
May 20, 2019
by
Fnac
Browse files
Options
Downloads
Patches
Plain Diff
Ya funciona buscar
parent
bbd4abd0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Source Packages/conexionDB/nookDB.java
+9
-8
9 additions, 8 deletions
Source Packages/conexionDB/nookDB.java
Source Packages/servlet/buscarSV.java
+1
-1
1 addition, 1 deletion
Source Packages/servlet/buscarSV.java
web/inicial.jsp
+3
-1
3 additions, 1 deletion
web/inicial.jsp
with
13 additions
and
10 deletions
Source Packages/conexionDB/nookDB.java
+
9
−
8
View file @
a6a094bb
...
...
@@ -189,25 +189,25 @@ public class nookDB {
public
static
ArrayList
<
Nook
>
buscarNook
(
String
busqueda
)
{
ConnectionPool
pool
=
ConnectionPool
.
getInstance
();
Connection
connection
=
pool
.
getConnection
();
ArrayList
<
Nook
>
lista
n
ooks
=
n
ull
;
ArrayList
<
Nook
>
lista
N
ooks
=
n
ew
ArrayList
()
;
/*String consulta = "SELECT * FROM Nook N, ClasificacionCategorias C "
+ "WHERE (N.idNook=C.idNook AND "
+ "N.nombre = ?"
+ "OR N.autor = ?"
+ "OR C.categoria = ?)";*/
String
consulta
=
"SELECT * FROM Nook WHERE nombre LIKE ? "
;
ResultSet
rs
=
null
;
String
consulta
=
"SELECT * FROM Nook WHERE nombre LIKE ? "
;
try
{
PreparedStatement
ps
=
connection
.
prepareStatement
(
consulta
);
ps
.
setString
(
1
,
"%"
+
busqueda
+
"%"
);
rs
=
ps
.
executeQuery
();
ps
.
setString
(
1
,
busqueda
);
ps
.
setString
(
2
,
busqueda
);
ps
.
setString
(
3
,
busqueda
);
while
(
rs
.
next
()){
Nook
nook
=
new
Nook
();
nook
.
setIdNook
(
rs
.
getInt
(
"idNook"
));
nook
.
setNombre
(
rs
.
getString
(
"nombre"
));
nook
.
setResumen
(
rs
.
getString
(
"resumen"
));
...
...
@@ -216,13 +216,14 @@ public class nookDB {
nook
.
setFechaModificacion
(
rs
.
getDate
(
"fechaModificacion"
));
nook
.
setDescargas
(
rs
.
getInt
(
"descargas"
));
nook
.
setValoracionMedia
(
rs
.
getDouble
(
"valoracionmedia"
));
listanooks
.
add
(
nook
);
listaNooks
.
add
(
nook
);
}
rs
.
close
();
ps
.
close
();
pool
.
freeConnection
(
connection
);
return
lista
n
ooks
;
return
lista
N
ooks
;
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
...
...
This diff is collapsed.
Click to expand it.
Source Packages/servlet/buscarSV.java
+
1
−
1
View file @
a6a094bb
...
...
@@ -41,7 +41,7 @@ public class buscarSV extends HttpServlet {
String
busqueda
=
request
.
getParameter
(
"search"
);
ArrayList
<
String
>
categoriasNook
;
ArrayList
<
String
>
categorias
=
new
ArrayList
<>();
ArrayList
<
Nook
>
listNook
=
nookDB
.
getNooksDescargas
(
);
ArrayList
<
Nook
>
listNook
=
nookDB
.
buscarNook
(
busqueda
);
StringBuilder
str
;
for
(
int
i
=
0
;
i
<
listNook
.
size
();
i
++){
...
...
This diff is collapsed.
Click to expand it.
web/inicial.jsp
+
3
−
1
View file @
a6a094bb
...
...
@@ -45,7 +45,9 @@ and open the template in the editor.
<form
class=
"search-bar"
method=
"post"
action=
"/buscarSV"
>
<input
type=
"search"
placeholder=
"🔍 Busca aqu nooks..."
name=
"search"
required
>
<div
class=
"clearfix"
>
<input
type=
"submit"
value=
"Buscar"
>
</div>
</form>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment