Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jweb-e002-JSP
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
Pedro Rolon
jweb-e002-JSP
Commits
624d5403
Commit
624d5403
authored
Nov 28, 2018
by
Pedro Rolon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se agregó código para ordenar las cartas del ejercicio 3
parent
f61f5997
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletions
+33
-1
jweb-e002/build/classes/.gitignore
+2
-0
jweb-e002/build/classes/servlets/ManoDoc.class
+0
-0
jweb-e002/src/servlets/ManoDoc.java
+31
-1
No files found.
jweb-e002/build/classes/.gitignore
0 → 100644
View file @
624d5403
/clases/
/servlets/
jweb-e002/build/classes/servlets/ManoDoc.class
View file @
624d5403
No preview for this file type
jweb-e002/src/servlets/ManoDoc.java
View file @
624d5403
...
...
@@ -6,6 +6,8 @@ import java.io.InputStreamReader;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.nio.charset.Charset
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
javax.servlet.RequestDispatcher
;
import
javax.servlet.ServletException
;
...
...
@@ -56,9 +58,37 @@ public class ManoDoc extends HttpServlet {
System
.
out
.
println
(
nombreJugada
);
System
.
out
.
println
(
"************************"
);
ArrayList
<
String
>
manoString
=
new
ArrayList
<
String
>();
for
(
int
i
=
0
;
i
<
mano
.
length
;
i
++)
{
if
(
mano
[
i
].
valor
.
equals
(
"A"
))
{
mano
[
i
].
valor
=
"R"
;
}
else
if
(
mano
[
i
].
valor
.
equals
(
"T"
)){
mano
[
i
].
valor
=
"10"
;
}
manoString
.
add
(
mano
[
i
].
valor
+
mano
[
i
].
palo
);
}
Collections
.
sort
(
manoString
);
for
(
int
i
=
0
;
i
<
mano
.
length
;
i
++)
{
if
(
manoString
.
get
(
i
).
charAt
(
0
)==
'R'
)
{
mano
[
i
]
=
new
Carta
(
"A"
+
manoString
.
get
(
i
).
charAt
(
1
));
}
else
if
(
manoString
.
get
(
i
).
charAt
(
0
)==
'1'
&&
manoString
.
get
(
i
).
charAt
(
1
)==
'0'
){
mano
[
i
]
=
new
Carta
(
"T"
+
manoString
.
get
(
i
).
charAt
(
2
));
}
else
{
mano
[
i
]
=
new
Carta
(
manoString
.
get
(
i
));
}
}
request
.
setAttribute
(
"mano"
,
mano
);
request
.
setAttribute
(
"nombreJugada"
,
nombreJugada
);
RequestDispatcher
rd
=
getServletContext
().
getRequestDispatcher
(
"/WEB-INF/jsp/mano_doc.jsp"
);
rd
.
forward
(
request
,
response
);
}
...
...
@@ -72,7 +102,7 @@ public class ManoDoc extends HttpServlet {
public
static
String
obtenerJson
(
String
myURL
)
{
System
.
setProperty
(
"http.agent"
,
"Chrome"
);
System
.
out
.
println
(
"Requeted URL:"
+
myURL
);
System
.
out
.
println
(
"Reque
s
ted URL:"
+
myURL
);
StringBuilder
sb
=
new
StringBuilder
();
URLConnection
urlConn
=
null
;
InputStreamReader
in
=
null
;
...
...
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