@ p a g e c o n te n tt y p e = " te x t/ h tm l;c h a rs e t= u tf- 8 " fo r (in t i= 0 ; i< = 1 0 ; i+ + ) { o u t.p rin tln (" H e llo W o rld " + i + " < b r/> " ); = re s u lt + re s u lts u m ()
! S trin g n a m e = " G ild o n g H o n g " ; p u b lic b o o le a n is E x is t() { re tu rn tru e ; - - T h is is J S P C o m m e n t - - < js p :in c lu d e p a g e = " h e a d in g.js p " / > < c :if te s t= " $ {1 + 1 = = 2 " > A lw a y s tru e. < / c :if>
< u s e r:g e tu s e rs h o p p in g L is t u s e rid = " 1 3 " / > $ {c o lo rb e a n.re d
Ja v a 코드 1 ; Ja v a 코드 2 ; Ja v a 코드 3 ;...... 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 @ p a g e c o n te n tt y p e = " te x t/ h tm l;c h a rs e t= u tf- 8 " < h tm l> < h e a d > < title > 1 부터 1 0 0 까지의합구하기 < / title > < / h e a d > < b o d y > in t s u m = 0 ; fo r (in t i = 1 ; i < = 1 0 0 ; i+ + ) { s u m = s u m + i; 1 + 2 + 3 +...+ 9 9 + 1 0 0 = = s u m < / b o d y > < / h tm l>
0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 @ p a g e c o n te n tt y p e = " te x t/ h tm l; c h a rs e t= u tf- 8 " < h tm l> < h e a d > < title > 1 부터 1 0 0 까지의합구하기 < / title > < / h e a d > < b o d y > in t s u m = 0 ; fo r (in t i = 1 ; i < = 1 0 0 ; i+ + ) { s u m = s u m + i; fo r (in t i = 1 ; i < = 9 9 ; i+ + ) { = i + = 1 0 0 = = s u m < / b o d y > < / h tm l>
0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 @ p a g e c o n te n tt y p e = " te x t/ h tm l;c h a rs e t= u tf- 8 " < h tm l> < h e a d > < title > 1 부터 1 0 0 까지의합구하기 < / title > < / h e a d > < b o d y > in t s u m = 0 ; fo r (in t i = 1 ; i < = 1 0 0 ; i+ + ) { s u m = s u m + i; fo r (in t i = 1 ; i < = 9 9 ; i+ + ) { o u t.p rin t(i + " + " ); o u t.p rin t(1 0 0 + " = " + s u m ); < / b o d y > < / h tm l> in t s u m = 0 ; fo r (in t i = 1 ; i < = 1 0 0 ; i+ + ) { s u m = s u m + i; fo r (in t i = 1 ; i < = 9 9 ; i+ + ) { o u t.p rin t(i + " + " ); o u t.p rin t(1 0 0 + " = " + s u m );
= 값
0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 @ p a g e c o n te n tt y p e = " te x t/ h tm l;c h a rs e t= u tf- 8 " < h tm l> < h e a d > < title > 표현식예제 < / title > < / h e a d > < b o d y > 단순한문자열출력 : = " < b > 표현식예제 < / b > " < h r/> in t i = 1 0 ; ja v a.u til.c a le n d a r c a l = ja v a.u til.c a le n d a r.g e tin s ta n c e (); 변수값출력 : = i < h r/> 수식값 (1 부터 1 0 까지의합 ): = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 0 < h r/> 메소드호출에의한결과값 : = c a l.g e tt im e () < h r/> 변수 i 를활용한문자열과연산의결합 : = " i+ 1 0 = " + (i+ 1 0 ) < / b o d y > < / h tm l>
! 멤버변수선언 ; 멤버메소드선언! p u b lic 리턴타입메소드이름 ( 파라미터리스트 ) { J a v a 코딩문장 ; J a v a 코딩문장 ;...... (re tu rn 값 ;)
0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 3 0 3 1 @ p a g e c o n te n tt y p e = " te x t/ h tm l;c h a rs e t= u tf- 8 "! S trin g s tr = " 선언예제 " ; p u b lic d o u b le c a lc u la to r(d o u b le n u m 1, d o u b le n u m 2, S trin g o p e ra to r) { d o u b le re s u lt = 0.0 ; if (o p e ra to r.e q u a ls (" + " )) { re s u lt = n u m 1 + n u m 2 ; e ls e if (o p e ra to r.e q u a ls (" - " )) { re s u lt = n u m 1 - n u m 2 ; e ls e if (o p e ra to r.e q u a ls (" * " )) { re s u lt = n u m 1 * n u m 2 ; e ls e if (o p e ra to r.e q u a ls (" / " )) { re s u lt = n u m 1 / n u m 2 ; re tu rn re s u lt; < h tm l> < h e a d > < title > 선언예제 < / title > < / h e a d > < b o d y > = s tr < h r/> 1 0 + 5 = = c a lc u la to r(1 0, 5, " + " ) < b r/ > 1 0-5 = = c a lc u la to r(1 0, 5, " - " ) < b r/> 1 0 * 5 = = c a lc u la to r(1 0, 5, " * " ) < b r/> 1 0 / 5 = = c a lc u la to r(1 0, 5, " / " ) < / b o d y > < / h tm l>
p a c k a g e o rg.a p a c h e.js p.js p b o o k.c h 0 4 ; im p o rt ja v a x.s e rv le t.* ; im p o rt ja v a x.s e rv le t.h ttp.* ; im p o rt ja v a x.s e rv le t.js p.* ; p u b lic fin a l c la s s d e c l_ js p e x te n d s o rg.a p a c h e.ja s p e r.ru n tim e.h ttp J s p B a s e im p le m e n ts o rg.a p a c h e.ja s p e r.ru n tim e.j s p S o u rc e D e p e n d e n t { S trin g s tr = " 선언예제 " ; p u b lic d o u b le c a lc u la to r(d o u b le n u m 1, d o u b le n u m 2, S trin g o p e ra to r) { d o u b le re s u lt = 0.0 ; if (o p e ra to r.e q u a ls (" + " )) { re s u lt = n u m 1 + n u m 2 ; e ls e if (o p e ra to r.e q u a ls (" - " )) { re s u lt = n u m 1 - n u m 2 ; e ls e if (o p e ra to r.e q u a ls (" * " )) { re s u lt = n u m 1 * n u m 2 ; e ls e if (o p e ra to r.e q u a ls (" / " )) { re s u lt = n u m 1 / n u m 2 ; re tu rn re s u lt; p riv a te s ta tic fin a l Js p F a c to ry _ js p x F a c to ry = Js p F a c to ry.g e td e fa u ltf a c to ry (); p riv a te s ta tic ja v a.u til.l is t _ js p x _ d e p e n d a n ts ; p riv a te ja v a x.e l.e x p re s s io n F a c to ry _ e l_ e x p re s s io n fa c to ry ; p riv a te o rg.a p a c h e.a n n o ta tio n P ro c e s s o r _ js p _ a n n o ta tio n p ro c e s s o r; p u b lic O b je c t g e td e p e n d a n ts () { re tu rn _ js p x _ d e p e n d a n ts ; p u b lic v o id _ js p In it() { _ e l_ e x p re s s io n fa c to ry = _ js p x F a c to ry.g e tjs p A p p lic a tio n C o n te x t(g e ts e rv le tc o n fig ().g e ts e rv le tc o n te x t()).g e te x p re s s io n F a c to ry (); _ js p _ a n n o ta tio n p ro c e s s o r = (o rg.a p a c h e.a n n o ta tio n P ro c e s s o r) g e ts e rv le tc o n fig ().g e ts e rv le tc o n te x t().g e ta ttrib u te (o rg.a p a c h e.a n n o ta tio n P ro c e s s o r.c la s s.g e tn a m e ()); p u b lic v o id _ js p D e s tro y () { p u b lic v o id _ js p S e rv ic e (H ttp S e rv le tr e q u e s t re q u e s t, H ttp S e rv le tr e s p o n s e re s p o n s e ) th ro w s ja v a.io.io E x c e p tio n, S e rv le te x c e p tio n {... 중간생략...
- - JS P 코드에대한설명 - - - - JS P 코드에대한설명 - - 또다른설명 - - - -
/ / Ja v a 주석첫번째 / * J a v a 주석두번째 * / / * * Ja v a 주석세번째 * / <!- - H T M L 주석 - - >
<!- - = u s e rn a m e 이작성하는코드입니다. - - > 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 2 4 2 5 @ p a g e c o n te n tt y p e = " te x t/ h tm l;c h a rs e t= u tf- 8 "! / * * Ja v a 주석세번째것입니다 (p lu s : n u m 1 과 n u m 2 를더한값을리턴한다.) * / p u b lic in t p lu s (in t n u m 1, in t n u m 2 ) { re tu rn n u m 1 + n u m 2 ; < h tm l> < h e a d > < title > 주석예제 < / title > < / h e a d > <!- - H T M L 주석을사용합니다. - - > < b o d y > - - J S P 주석을사용합니다. - - / / Ja v a 주석첫번째것입니다. in t n u m 1 = 1 0 ; in t n u m 2 = 2 0 ; / * Ja v a 주석두번째것입니다. n u m 1 과 n u m 2 를더해서 re s u lt 에할당한다. * / in t re s u lt = p lu s (n u m 1, n u m 2 ); = n u m 1 과 = n u m 2 를더한값은 = re s u lt 입니다. < / b o d y > < / h tm l>
< h tm l> < h e a d > < title > 주석예제 < / title > < / h e a d > <!- - H T M L 주석을사용합니다. - - > < b o d y > 1 0 과 2 0 를더한값은 3 0 입니다. < / b o d y > < / h tm l>