From 05e819e4ef0cd435debc3b9a4d8ff34c654878c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 11 Apr 2018 14:40:36 +0200 Subject: [PATCH] Add exo4 missing bits and exo10 code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- ROOT/exo10/WEB-INF/classes/date/Date.class | Bin 0 -> 1571 bytes .../WEB-INF/classes/date/DateRefresh.class | Bin 0 -> 1317 bytes .../exo10/WEB-INF/classes/form/Checkbox.class | Bin 0 -> 1469 bytes ROOT/exo10/WEB-INF/classes/form/Login.class | Bin 0 -> 1732 bytes .../WEB-INF/classes/hello/HelloWorld.class | Bin 1271 -> 1297 bytes ROOT/exo10/WEB-INF/src/date/Date.java | 43 ++++++++++++ ROOT/exo10/WEB-INF/src/date/DateRefresh.java | 44 ++++++++++++ ROOT/exo10/WEB-INF/src/form/Checkbox.java | 42 ++++++++++++ ROOT/exo10/WEB-INF/src/form/Login.java | 63 ++++++++++++++++++ ROOT/exo10/WEB-INF/src/hello/HelloWorld.java | 2 +- ROOT/exo10/form.html | 14 ++++ ROOT/exo10/formcheckbox.html | 19 ++++++ ROOT/exo4/WEB-INF/src/bonjour/hello.java | 7 ++ ROOT/exo4/WEB-INF/web.xml | 9 +++ ROOT/exo4/hello.jsp | 9 +++ ROOT/exo7/cookie-form.html | 1 + 16 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 ROOT/exo10/WEB-INF/classes/date/Date.class create mode 100644 ROOT/exo10/WEB-INF/classes/date/DateRefresh.class create mode 100644 ROOT/exo10/WEB-INF/classes/form/Checkbox.class create mode 100644 ROOT/exo10/WEB-INF/classes/form/Login.class create mode 100644 ROOT/exo10/WEB-INF/src/date/Date.java create mode 100644 ROOT/exo10/WEB-INF/src/date/DateRefresh.java create mode 100644 ROOT/exo10/WEB-INF/src/form/Checkbox.java create mode 100644 ROOT/exo10/WEB-INF/src/form/Login.java create mode 100644 ROOT/exo10/form.html create mode 100644 ROOT/exo10/formcheckbox.html create mode 100644 ROOT/exo4/WEB-INF/src/bonjour/hello.java create mode 100644 ROOT/exo4/WEB-INF/web.xml create mode 100644 ROOT/exo4/hello.jsp diff --git a/ROOT/exo10/WEB-INF/classes/date/Date.class b/ROOT/exo10/WEB-INF/classes/date/Date.class new file mode 100644 index 0000000000000000000000000000000000000000..6e7c1aba55ef025d05577f2b2d88ff491c48b9cc GIT binary patch literal 1571 zcmah}{Z|`B6ulEdc1c!B18r@!l~$=qB&;I!qd~Lf->rppu$y>fgGp4!CX{rL} zYozDz$%dc!gnA`>XoPg| z8m0xtPs;1y6})O;!@(xD99+aDVpH-!^WO_BeBq#mx`S7aoft+zf|vT(=2UDUOs z8MP1DfO96bX-{3nez<$H>j!Na6M=>`?cg5nJNOD;6X;?y=9P)H)$Qq)7X;Ix>6MB3 zhN>;PgQT=fJ;G`;iJ>BJNtgQfUOg8u5bCJ+93}(SkKF3!koWX4g~5ao%f1(M<>vPS zXA9Nh3uo}^f5WNC{!CE)M5^V8vm2`I!wx%jrayM>kZPP90oxB%L)SHPT_yWnsdi$Y zEv3+f0Sv<5qR@i_j=>SDAvYOxbWjkoS6-(hL;lUmFRDAl?L-5a*j7>BB{220`Y`5a zGHx~>$d;-Mt93FXF7pF&fuEQZAC920IDOpH5PDR(Ugq0H?t=Sh=@G;)Gz6}2%@}8n z>+1|nna~A{81Gc+2~u|-VdNpwrIFt-`Vg7po8ycE^2lM5&lKL^n=U!S-&MRh$n__q zMtSn{Y~FedJB8A($ZVAK+QV4-J7&GdwAa(+o!Q683T%|~xgMNy{w2LW!8ie&%1`ug zns?GYu+JaS0@ literal 0 HcmV?d00001 diff --git a/ROOT/exo10/WEB-INF/classes/date/DateRefresh.class b/ROOT/exo10/WEB-INF/classes/date/DateRefresh.class new file mode 100644 index 0000000000000000000000000000000000000000..8f1a417267324ee9826f69cb259dd2173bd934a3 GIT binary patch literal 1317 zcmah|?NZZF5Iwh)CbUs7fP5$jD5Zs#h~gKmDBmE6SQr?`Un#jloHVJ)Ed#IM+xVvp zGUEgIP>y@kf*p(4AA9%ip1XT?Px|xM_a6YJu^Gp0jH{SPAcL%mNfm~4A4)T&;!zxr zF|Fc>f~RpLB=ng)pDTC~M?1!)nURqh6*(1o1uqrMGQ{$>YYTE(Qt4fW=z?c)hV~8H z<(rjKk^4Jl(V<9G!WiO9$NRi2Y|jl8ykcmzycJIILTcl)d1M|N0r!s_E{sDV%El_0 z?OLF~zf^c2a{q+|Wvb0{>0Je{85D~i`Q8b2-u5c~K3}#an~p_O@B;tj^Wbn&HfHE6 zR9s<~_^ut;#CXniJz<7K8Aku=YF;LdJzlIc%+ZjpS)%HRhU#>y_|BFo1oz#5K{FbX z8hX&n&?fk?oVesDnA0$i1tMN&$H1mEEMiH+GFIfiC2m&1s)jWQjOB}-bwUF4$TA)36tZh_ZSCH4Uq3!W>uD|SxGwCnELhtoJWX-_*fEo+sV z;rwG)U_wQkUmb9<=i8(e?K73Gfr#uD?X#XBnJ;H(2-6D766ClfiCHdl*J8+C(YRi; zStly23a=&|L)S(324D`u=%)X%{6#?w(Mz_EZUb~OI$Ot2!M>5h&`&lN1`}lO5Hu1( zC0s(AU|qONVOdvJ8^pc(gRc~eQl^m6BWGxdAfre1)-%LfkU4|Gu$k4>D%!GoT-tLa zKAb|+Z&Y#f9PQ+HRB?+gRp=qAGqhb~{}4^0jXLy0C89cY?!yq-VT@t~OJvuP#Cwc| p3}eJ=fbxv;7xVvfs0jj(Q0WNn;{lzW^lX%F$$+Y*K7s{E{|3`OI_&@e literal 0 HcmV?d00001 diff --git a/ROOT/exo10/WEB-INF/classes/form/Checkbox.class b/ROOT/exo10/WEB-INF/classes/form/Checkbox.class new file mode 100644 index 0000000000000000000000000000000000000000..885859249b7ebf825ccaa01e6ea6aca43bd13374 GIT binary patch literal 1469 zcmah}U3U{z6x}yXGLvLVA+(gDt)hf}&~yY8gv2UT5VW*0VU@+=#YuB5Ba@k7=7!b2 z^Gkg3*$3NIS?~k=3;Yuw(0yl;(v~U@Ip@y3`<%PaKIi7IH-EkY@HtvVjG}5_p@5UH zO?+0uMO-p*xx~XS^v4wwSBv-(*GybDP%FYhRhznrue4t@@wJI>4BRkqQ@{v4XG=!0 zz{y9;zc|kv+jIO4yQL!6->3=X>#pyrMS-E2*)@UeQqYkCBg?KYS9;yHjP5&ak2_fn z6DZ!=T$iD813xyf#PCkg2x1;IXOirjb}XZ3o>cZ@r9%4-O)K4K%BMXUtJ-^EameJd zrr8X)l(YWio)ab{44g9Xt$|yts>4)Kuth?xpck#n+pZ=#y!2SEKWPV>3%XK)iDu7N zZdb0kvCArM_ebN*t>pNYhHV3H%O1;QyI7-RLr>q5gaAIK` zrv;85R@uTBP7$c&rk17a8MtlXJKUjsX?G0VweUTDu&|7Kx+fa7$YL$5B(Qor=xnh` z3kgQ&a5S71t~`|p;$1L&)=Hv=51 zgpeE94bGE#5V=%k-|pSjec1E=e_Kk)*fgcpOB5>7$Y!`9=y1ACxveGn+o6gEezdj8IG9`Rtz)hSKi{RFAqM z4d3?)`#od|Qw8b66c`=cvkzFqS^g`G@{d9wqlb#CEY}=6+6jJ5(hK_B+z!O=3GfVU zKG`hMen4m@fmY}>v@mD9MCK0+y@eNf1e}10GCt%=-=Q;4;iG==Huv&8apud}UF0&j zP|okd$Y5oD7pB1V>_oO)*hZ1AL^pILH{H=(+kJQGe5CGJjmcY!$J84X81K5V-6P{LByE< E7fS|W@c;k- literal 0 HcmV?d00001 diff --git a/ROOT/exo10/WEB-INF/classes/form/Login.class b/ROOT/exo10/WEB-INF/classes/form/Login.class new file mode 100644 index 0000000000000000000000000000000000000000..854675df5ecdb621fb4de8fe523d8f782ac7d9fd GIT binary patch literal 1732 zcmd5+ZBr9T5Pl{k*(F)QTTleW!$UaU;>wGnz;UN2ipNVXLD2Hk#*DaDvKx0N9^AjO zO0hVq`~ml)u6$;bgNS;4`2q5Gw8*nfvF49hPiyOFU;(|WUnV8RD0l%17H1KN%otQN7n_h2eaofa_i906lnpie)&%k|w zR3+H)d;xp)h5O2NDz3ld6jkW?JM#i&&5fczgRm@+UhsTREef=ajBW`emx8hs=v?)D zxn8f9WVq>;D%2#kn?UC7?o(M)Uf@RtR+y$7+>_K7M&dlXP9(!u6{(!(O4XeE6vc+3 zAYayHq~^cs7S$MA&W~;xctCjNARk0bV3c_~4E6}27}Ue3a@o_cGOL>A70pqgw@~+$ zSCv~{t3ZSLlz-UKR00EA+{`R;}HQbltNz08=&8U(~QMkoQ4k1g0R}aFK|(( z_;Ry8acI`(sQCh2F-R|PRyJC+!~Y+*ARFBk=!m3R3VbDfwYgVg!Ot`X=%Yc^13C1y zi1AnnSUXbX-H^>=uLOoa7w&UUp`G`(LodG6Gcww6A+0>0O4GopIAYtPW|?c+slr#5 zc55~1^Eu_dDQ~l(`X#EM@hSzn|I6O`R&j|RhF*R(68v$x;vEN!YYIZoA?1%e^>Y|?wpiOUc8J8|cW8Ty;fQ>A=a2DP8iKis5 z4)T8)L(OpS>6N7AuL(PS03(61aoapVdjdM{xSeV4QxgZs3asaBYagd_c88XS=p=&E z_7D58$KD{xWglI!y}Q+ZreROD*w4mZJ(S0Yr(h9DA57Mxn}i2Q_-D!-=}!~?8nG9N zy-M^EhOtMhW|bzFL7oNA-!HEmd0i#1Niv!u(rNOVp}a<3*U4*^yl#-!P4b#M!E5Ab lQuH(l{XZ^SV@eiTgi#vUL5y?lqT2*dxd>O_Jb{RC^#eqOiH86H literal 0 HcmV?d00001 diff --git a/ROOT/exo10/WEB-INF/classes/hello/HelloWorld.class b/ROOT/exo10/WEB-INF/classes/hello/HelloWorld.class index 24e3e9716b89d97e743dce53351d464f3353f19e..ffc0db36374dc54ebae9f7cd6fd49fcd51483b8d 100644 GIT binary patch delta 51 zcmey)Igx9_Rz@{dr_9v6vedlNRE5M+h2;FwqGE*<^~8dLoXq6JlFa"); + out.println(""); + out.println("Date " + d.toString()); + out.println("
"); + out.println("GET call number " + count); + out.println(""); + out.println(""); + } + + public void destroy() { + count = 0; + } +} diff --git a/ROOT/exo10/WEB-INF/src/date/DateRefresh.java b/ROOT/exo10/WEB-INF/src/date/DateRefresh.java new file mode 100644 index 0000000..24cbd5f --- /dev/null +++ b/ROOT/exo10/WEB-INF/src/date/DateRefresh.java @@ -0,0 +1,44 @@ +package date; + +// Import required java libraries +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.annotation.WebServlet; + +@WebServlet(name="DateRefresh", urlPatterns={"/DateRefresh"}) +// Extend HttpServlet class +public class DateRefresh extends HttpServlet { + + //private java.util.Date d; + //private Integer count; + + public void init() throws ServletException { + // Do required initialization + //d = new java.util.Date(); // DateRefresh at init time, do not change + //count = 0; + } + + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + // Set response content type + response.setContentType("text/html"); + response.addHeader("Refresh", "1"); + + // Actual logic goes here. + //count++; + PrintWriter out = response.getWriter(); + out.println(""); + out.println(""); + out.println("Date " + new java.util.Date().toString()); + //out.println("
"); + //out.println("GET call number " + count); + out.println(""); + out.println(""); + } + + public void destroy() { + //count = 0; + } +} diff --git a/ROOT/exo10/WEB-INF/src/form/Checkbox.java b/ROOT/exo10/WEB-INF/src/form/Checkbox.java new file mode 100644 index 0000000..7a55915 --- /dev/null +++ b/ROOT/exo10/WEB-INF/src/form/Checkbox.java @@ -0,0 +1,42 @@ +package form; + +// Import required java libraries +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.annotation.WebServlet; + +@WebServlet(name="Checkbox", urlPatterns={"/Checkbox"}) +// Extend HttpServlet class +public class Checkbox extends HttpServlet { + + private String[] players; + + public void init() throws ServletException { + // Do required initialization + players = new String[4]; + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + // Set response content type + response.setContentType("text/html"); + + String[] players = request.getParameterValues("player"); + + // Actual logic goes here. + PrintWriter out = response.getWriter(); + out.println(""); + out.println(""); + for (int i = 0; i < players.length; i++) { + out.println(players[i] + "
"); + } + out.println(""); + out.println(""); + } + + public void destroy() { + + } +} diff --git a/ROOT/exo10/WEB-INF/src/form/Login.java b/ROOT/exo10/WEB-INF/src/form/Login.java new file mode 100644 index 0000000..4f4f8d1 --- /dev/null +++ b/ROOT/exo10/WEB-INF/src/form/Login.java @@ -0,0 +1,63 @@ +package form; + +// Import required java libraries +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +import javax.servlet.annotation.WebServlet; + +@WebServlet(name="Login", urlPatterns={"/Login"}) +// Extend HttpServlet class +public class Login extends HttpServlet { + + private String login; + private String password; + + public void init() throws ServletException { + // Do required initialization + login = new String(); + password = new String(); + } + + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + // Set response content type + response.setContentType("text/html"); + + // Actual logic goes here. + login = request.getParameter("login"); + password = request.getParameter("password"); + PrintWriter out = response.getWriter(); + out.println(""); + out.println(""); + out.println("Login: " + login); + out.println("
"); + out.println("Password: " + password); + out.println(""); + out.println(""); + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + // Set response content type + response.setContentType("text/html"); + + // Actual logic goes here. + login = request.getParameter("login"); + password = request.getParameter("password"); + PrintWriter out = response.getWriter(); + out.println(""); + out.println(""); + out.println("Login: " + login); + out.println("
"); + out.println("Password: " + password); + out.println(""); + out.println(""); + } + + public void destroy() { + + } +} diff --git a/ROOT/exo10/WEB-INF/src/hello/HelloWorld.java b/ROOT/exo10/WEB-INF/src/hello/HelloWorld.java index 446f823..f25597f 100644 --- a/ROOT/exo10/WEB-INF/src/hello/HelloWorld.java +++ b/ROOT/exo10/WEB-INF/src/hello/HelloWorld.java @@ -14,7 +14,7 @@ public class HelloWorld extends HttpServlet { public void init() throws ServletException { // Do required initialization - message = "Hello World"; + message = "Bienvenue au cours d'applications Web"; } public void doGet(HttpServletRequest request, HttpServletResponse response) diff --git a/ROOT/exo10/form.html b/ROOT/exo10/form.html new file mode 100644 index 0000000..087835a --- /dev/null +++ b/ROOT/exo10/form.html @@ -0,0 +1,14 @@ + + + + +
+ Login:
+
+ Password:
+

+ +
+ + + diff --git a/ROOT/exo10/formcheckbox.html b/ROOT/exo10/formcheckbox.html new file mode 100644 index 0000000..afc6e0d --- /dev/null +++ b/ROOT/exo10/formcheckbox.html @@ -0,0 +1,19 @@ + + + + +
+ Quel joueur préférez-vous ?
+ +
+ +
+ +
+ +

+ +
+ + + diff --git a/ROOT/exo4/WEB-INF/src/bonjour/hello.java b/ROOT/exo4/WEB-INF/src/bonjour/hello.java new file mode 100644 index 0000000..9970d64 --- /dev/null +++ b/ROOT/exo4/WEB-INF/src/bonjour/hello.java @@ -0,0 +1,7 @@ +package bonjour; + +public class hello { + public String affiche() { + return "Bonjour"; + } +} diff --git a/ROOT/exo4/WEB-INF/web.xml b/ROOT/exo4/WEB-INF/web.xml new file mode 100644 index 0000000..7f339c8 --- /dev/null +++ b/ROOT/exo4/WEB-INF/web.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/ROOT/exo4/hello.jsp b/ROOT/exo4/hello.jsp new file mode 100644 index 0000000..11fcb52 --- /dev/null +++ b/ROOT/exo4/hello.jsp @@ -0,0 +1,9 @@ +<%@ page import="bonjour.hello, javax.servlet.*" %> + + +<% + hello h = new hello(); + //out.print(h.afficher()); +%> + + diff --git a/ROOT/exo7/cookie-form.html b/ROOT/exo7/cookie-form.html index 10bbcaa..aba78e8 100644 --- a/ROOT/exo7/cookie-form.html +++ b/ROOT/exo7/cookie-form.html @@ -1,3 +1,4 @@ + -- 2.34.1