04장

Similar documents
Data Provisioning Services for mobile clients

chapter3.doc

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r

KYO_SCCD.PDF

14-Servlet

rmi_박준용_final.PDF

중간고사

JavaGeneralProgramming.PDF

Microsoft PowerPoint - 4강.pptx

다른 JSP 페이지호출 forward() 메서드 - 하나의 JSP 페이지실행이끝나고다른 JSP 페이지를호출할때사용한다. 예 ) <% RequestDispatcher dispatcher = request.getrequestdispatcher(" 실행할페이지.jsp");

01-도입-12-27

02 C h a p t e r Java

J2EE Concepts

슬라이드 1

2장 변수와 프로시저 작성하기

PowerPoint 프레젠테이션

서블릿의라이프사이클 뇌를자극하는 JSP & Servlet

PowerPoint 프레젠테이션

TP_jsp7.PDF

chapter5.doc

12-file.key

chapter6.doc

3장

신림프로그래머_클린코드.key

MasoJava4_Dongbin.PDF

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

05-class.key

<4D F736F F F696E74202D20B5A5C0CCC5CDBAA3C0CCBDBA5F3130C1D6C2F75F31C2F7BDC32E >

09-interface.key

chapter1,2.doc

Interstage5 SOAP서비스 설정 가이드

Microsoft PowerPoint - 04-UDP Programming.ppt

뇌를 자극하는 JSP & Servlet 슬라이드

API STORE 키발급및 API 사용가이드 Document Information 문서명 : API STORE 언어별 Client 사용가이드작성자 : 작성일 : 업무영역 : 버전 : 1 st Draft. 서브시스템 : 문서번호 : 단계 : Docum

Microsoft PowerPoint - web-part03-ch19-node.js기본.pptx

Microsoft PowerPoint - 7강.pptx

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f…

Data Provisioning Services for mobile clients

뇌를 자극하는 JSP & Servlet 슬라이드

PowerPoint Presentation

mytalk

JAVA Bean & Session - Cookie

<C4FBC1EEB7CE20C1A4B8AEC7D5BDC3B4D95FC1A4B4E42E687770>

3ÆÄÆ®-14

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형

*00¬˜∑ -√÷¡æ(ƒÆ∂Û∫Ø∞Ê)

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

1

자바-11장N'1-502

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

2파트-07

01-OOPConcepts(2).PDF

03장

교육2 ? 그림

歯JavaExceptionHandling.PDF

JMF3_심빈구.PDF

JMF2_심빈구.PDF

<param-value> 파라미터의값 </param-value> </init-param> </servlet> <servlet-mapping> <url-pattern>/ 매핑문자열 </url-pattern> </servlet-mapping> - 위의예에서 ServletC

Microsoft PowerPoint - aj-lecture7.ppt [호환 모드]

뇌를 자극하는 JSP & Servlet 슬라이드

뇌를 자극하는 JSP & Servlet 슬라이드

Intro to Servlet, EJB, JSP, WS

뇌를 자극하는 JSP & Servlet 슬라이드

비긴쿡-자바 00앞부속

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

5장.key

2장 변수와 프로시저 작성하기

Eclipse 와 Firefox 를이용한 Javascript 개발 발표자 : 문경대 11 년 10 월 26 일수요일

07 자바의 다양한 클래스.key

<4D F736F F F696E74202D203130C0E52EBFA1B7AF20C3B3B8AE205BC8A3C8AF20B8F0B5E55D>

교육자료

자바 프로그래밍

C H A P T E R 2

혼자서일을다하는 JSP. 이젠일을 Servlet 과나눠서한다. JSP와서블릿의표현적인차이 - JSP는 <html> 내에서자바를사용할수있는수단을제공한다. - 서블릿은자바내에서 <html> 을작성할수있는수단을제공한다. - JSP나서블릿으로만웹페이지를작성하면자바와다양한코드가

DocsPin_Korean.pages

Java

Microsoft PowerPoint - aj-lecture4.ppt [호환 모드]

Cluster management software

JSP 의내장객체 response 객체 - response 객체는 JSP 페이지의실행결과를웹프라우저로돌려줄때사용되는객체이다. - 이객체는주로켄텐츠타입이나문자셋등의데이터의부가정보 ( 헤더정보 ) 나쿠키 ( 다음에설명 ) 등을지정할수있다. - 이객체를사용해서출력의방향을다른

1 ELS.~

목차 JEUS EJB Session Bean가이드 stateful session bean stateful sample 가이드 sample source 결과확인 http session에

rosaec_workshop_talk

PowerPoint 프레젠테이션

Ext JS À¥¾ÖÇø®ÄÉÀ̼ǰ³¹ß-³¹Àå.PDF

자바GUI실전프로그래밍2_장대원.PDF

Week13

FileMaker ODBC and JDBC Guide

ch09

Chap12

PowerPoint 프레젠테이션

Modern Javascript

03장.스택.key

50_1953.pdf

Data Provisioning Services for mobile clients

11 템플릿적용 - Java Program Performance Tuning (김명호기술이사)

NoSQL


Spring Boot

untitled

Microsoft PowerPoint - 03-TCP Programming.ppt

Transcription:

20..29 1: PM ` 199 ntech4 C9600 2400DPI 175LPI T CHAPTER 4

20..29 1: PM ` 200 ntech4 C9600 2400DPI 175LPI T CHAPTER 4.1 JSP (Comment) HTML JSP 3 home index jsp HTML JSP 15 16 17 18 19 20 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>jsp </title> <b>[ ]</b><br> <%! // private String method = ; private String mymethod() { return method; } %> 200

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T 4.1 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 <b>[ ]</b><br> <% String str = JSP ; int i = 2; int j = 5; out.println( str \ + str + \.<br> ); out.println( i = + i + <br> ); out.println( j = + j + <br> ); out.println( i + j = ); out.println(i + j + <br> ); out.println( method : + method + <br> ); out.println( mymethod() : + mymethod()); %> <br><br> <b>[ ]</b><br> str <%= str %>.<br> i = <%=i %><br> j = <%=j %><br> i + j = <%=i+j %><br> method : <%= method %><br> mymethod() : <%= mymethod() %> <br><br> <b>[ ]</b><br> <!-- html --> <%-- JSP <%= str %> --%> <% // /* */ %> 46 HTML 47 JSP // /* */ 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T CHAPTER [ ] localhost IP (http://192 168 1 1:80/home/index jsp) HTML JSP 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T 4.2 4.2 (Directive) JSP (request) JSP (response) JSP ( ) JSP 3 @ (at) 4.2.1 page JSP <%@ page 1= 1 2= 2 %> 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T CHAPTER 4.2.1.1 info <%@ page info= www.lug.or.kr %> 4.2.1.2 language JSP java <%@ page language= java %> 4.2.1.3 contenttype JSP MIME text/html text/plain text/xml text/gif text/html MIME <%@ page contenttype= text/html %> JSP charset ISO 8859 1 UTF 8(utf 8) <%@ page contenttype= text/html ; charset= UTF-8 %> this.getservletinfo() info <%@ page info= www.lug.or.kr language= java contenttype= text/html; charset=utf-8 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T 4.2 <title>page </title> <%=this.getservletinfo() %> 4.2.1.4 JSP JSP Servlet JSP Servlet extends JSP <%@ page extends= kr.or.lug.directive %> <%-- kr.or.lug.directive --%> 4.2.1.5 import JAVA import JSP package import page <%@ page import= java.util.*, java.text.* import= java.io.* %> <%-- (,). --%> <%-- import. --%> 4.2.1.6 session JSP HttpSession true false true false 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T CHAPTER true false <%@ page session= false %> 4.2.1.7 JSP out 8kb none JSP <%@ page buffer= 16kb %> <%@ page buffer= none %> buffer none <jsp:forward > 4.2.1.8 flush (full) (empty) autoflush ( ) true buffer false (OverFlow) (Exception) buffer none autoflush false true <%@ page autoflush= true %> <%@ page buffer= 1kb autoflush= false %> <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T 4.2 15 16 17 18 19 20 <title>autoflush </title> <% for (int i = 0; i <= 00 ; i++) { %> JSP <% } %> buffer 1kb autoflush false JSP buffer Overflow autoflush true 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T CHAPTER 4.2.1.9 ( ) isthreadsafe true <%@ page isthreadsafe= true %> 4.2.1. errorpage JSP <%@ page errorpage= error.jsp %> iserrorpage JSP 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T 4.2 false errorpage JSP iserrorpage true <%@ page iserrorpage= true %> 15 16 17 18 19 20 21 pageencoding= UTF-8 errorpage= /directive/error.jsp %> <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title> </title> <% int a = ; int b = 0; %> a b <br> a + b = <%=a + b %><br> a - b = <%=a - b %><br> a * b = <%=a * b %><br> a / b = <%=a / b %><!-- 0 --> JSP page errorpage /directive/error jsp home 19 a 0 Arithmetic Exception error jsp pageencoding= UTF-8 iserrorpage= true %> <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T CHAPTER 15 16 <title>!</title> <h1>exception Error!</h1>.<br> <%=exception.getmessage() %><br> <%=pagecontext.geterrordata().getthrowable().tostring() %> /derective/error jsp page iserrorpage true body pagecontext // exception exception.getmessage() // pagecontext ErrorData pagecontext.geterrordata().getthrowable().tostring() 4.2.1. pageencoding JSP ISO 8859 1 UTF 8 <%@ page pageencoding= UTF-8 %> pageencoding contenttype charset <%@ page pageencoding= UTF-8 contenttype= text/html %> <%@ page contenttype= text/html ; charset= UTF-8 %> 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T 4.2 4.2.2 include file <%@ include file= %> include JSP JSP 2 include include 2 top jsp bottom jsp include top jsp bottom jsp 15 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>include </title> top : <%@ include file= top.jsp %> <hr>include.jsp.<hr> bottom : <%@ include file= bottom.jsp %> <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T CHAPTER <title>top </title> top.<br> <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>bottom </title> <br>bottom. include? /WebContent/WEB INF/web xml 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T 4.2... <jsp-config> <jsp-property-group> <url-pattern>/directive/*</url-pattern> <include-prelude>/directive/top.jsp</include-prelude> <include-coda>/directive/bottom.jsp</include-coda> </jsp-property-group> </jsp-config> </web-app> web xml /directive * <include prelude> top jsp <include coda> bottom jsp web xml /directive page jsp top jsp bottom jsp web xml page jsp web xml 4.2.3 taglib JSP URI Prefix URI TLD(Tag Library Descriptor) TLD XML TLD Prefix JSP XML <%@ taglib uri= /META-INF/mytag.tld prefix= mytag %> 2

20..29 1: PM ` 2 ntech4 C9600 2400DPI 175LPI T CHAPTER <%@ taglib uri= /META-INF/mytag.tld prefix= mytag %> <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>taglib : </title> <mytag:getinfo name= myinfo /> <mytag:getinfo name= myinfo /> mytag tld GetInfo name myinfo mytag tld GetInfo name myinfo 2

20..29 1: PM ` 215 ntech4 C9600 2400DPI 175LPI T 4.3 JSTL(JSP Standard Tag Library) taglib 4.3 JSP JSP <jsp: /> 6 4.3.1 include include include include HTML JSP Servlet include include flush true <jsp:include page= flush= true /> 215

20..29 1: PM ` 216 ntech4 C9600 2400DPI 175LPI T CHAPTER 15 16 17 18 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>include </title> <h1>include </h1> <form method= post action= includetag.jsp > : <input type= text name= name ><br> : <input type= text name= nation ><br><br> <input type= submit value= > </form> <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN 216

20..29 1: PM ` 217 ntech4 C9600 2400DPI 175LPI T 4.3 15 16 17 18 19 <title>includetag.jsp</title> <% request.setcharacterencoding( utf-8 ); // String name = JSP ; // %> <jsp:include page= includetagheader.jsp flush= true /> <hr> include body. include jsp name nation utf 8 name name include 15 16 17 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>includetagheader.jsp</title> include header.<p> <h2> = <%=request.getparameter( name ) %> <br> = <%=request.getparameter( nation ) %> </h2> include jsp include jsp name nation includetagheader jsp JSP 217

20..29 1: PM ` 218 ntech4 C9600 2400DPI 175LPI T CHAPTER JSP include <jsp:param name= value= /> <jsp:include page= flush= true > <jsp:param name= value= /> <jsp:param name= value= /> </jsp:include> <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>include 2</title> <h1>include 2</h1> <form method= post action= includetag2.jsp > : <input type= text name= language ><br><br> 218

20..29 1: PM ` 219 ntech4 C9600 2400DPI 175LPI T 4.3 15 16 17 <input type= submit value= > </form> language includetag2 jsp JSP 15 16 17 18 19 20 21 22 23 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>includetag2.jsp</title> <% request.setcharacterencoding( utf-8 ); %> <jsp:include page= includetagheader2.jsp > <jsp:param name= language value= PHP /> </jsp:include> <hr> <b> request parameter : <%=request.getparameter( language ) %> </b><br> include body. utf 8 <jsp:include > includetagheader2 jsp language PHP 19 language JSP <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN 219

20..29 1: PM ` 220 ntech4 C9600 2400DPI 175LPI T CHAPTER 15 16 <title>includetagheader2.jsp</title> include header.<p> <h2> = <%=request.getparameter( language ) %> </h2> includetagheader2 jsp language includetag2 jsp include PHP <jsp:include > include 220

20..29 1: PM ` 221 ntech4 C9600 2400DPI 175LPI T 4.3 4.3.2 forwad include JSP JSP forward <jsp:forward page= /> <jsp:forward page= ></jsp:forward> <jsp:forward page= <%=expression %> /> 221

20..29 1: PM ` 222 ntech4 C9600 2400DPI 175LPI T CHAPTER forward 4 15 forward forward 15 16 17 18 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>forward </title> <h1>forward </h1> <form method= post action= forwardtag.jsp > ID : <input type= text name= id ><br> PASSWORD : <input type= password name= pass ><br><br> <input type= submit value= > </form> form id pass forwardtag jsp 15 16 17 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>forwardtag.jsp</title> <% request.setcharacterencoding( utf-8 ); %> forward <jsp:forward page= forwardtag2.jsp /> 222

20..29 1: PM ` 223 ntech4 C9600 2400DPI 175LPI T 4.3 utf 8 forward forwardtag2 jsp forward 15 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title>forwardtag2.jsp</title> forwardtag2.jsp.<hr> <%=request.getparameter( id ) %>.<br> <%=request.getparameter( pass ) %>. ID jsp PASSWORD asdfgh URL forwardtag2 jsp forward <jsp:param name= value= /> 223

20..29 1: PM ` 224 ntech4 C9600 2400DPI 175LPI T CHAPTER <jsp:forward page= > <jsp:param name= value= /> <jsp:param name= value= /> </jsp:forward> 4.3.3 <jsp:plugin > JSP JSP <jsp:plugin > 4.3.4 usebean (JavaBeans) <jsp:usebean id= class= /> <jsp:setproperty name= property= /> <jsp:getproperty name= property= /> usebean getproperty JSP setproperty getproperty getter (getxxx()) setter (setxxx()) usebean 4.4 JSP <%! %> <%= %> 224

20..29 1: PM ` 225 ntech4 C9600 2400DPI 175LPI T 4.4 4.4.1 (Declaration) JSP (parsing) Servlet JSP _jspservice() <%!. %> 15 16 17 18 19 20 21 22 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title> </title> <%! String name = JSP ; int year = 20; public String getname() { return name; } %> : <%=name %><br> getname() : <%=getname() %><br> : <%=year %> <%! %> 2 getname() name (<%=name %>) getname() 225

20..29 1: PM ` 226 ntech4 C9600 2400DPI 175LPI T CHAPTER (<%=getname() %>) year (<%=year %>) 4.4.2 (Expression) <%= %> (;) out println() out println() + : <%=name %> : <%=getname() %> : <%= i+0= +(i+0)+ %> 4.5 (Scriptlet) JSP JSP JSP _jspservice() EL(Expression Language) JSTL HTML out println() HTML <%, if/for/while/switch %> 226

20..29 1: PM ` 227 ntech4 C9600 2400DPI 175LPI T 4.5 15 16 17 18 19 20 21 22 23 24 25 26 27 28 <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4. Transitional//EN <title> </title> <% // int number = 1; for (int i =0; i < 5; i++) { out.println(number + : ); out.println(getname() + <br> ); number++; } %> <%! // String name = ; public String getname() { return name; } %> scriptlet_jsp java _jspservice() JSP JSP JAVA JSP out println() HTML JSTL 227

20..29 1: PM ` 228 ntech4 C9600 2400DPI 175LPI T CHAPTER <% // int number = 1; for (int i =0; i < 5; i++) { //out.println(number + : ); //out.println(getname() + <br> ); //number++; //} %> <%=number %> : <%=getname() %><br> <% number++; } %> package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class scriptlet_jsp extends org.apache.jasper.runtime.httpjspbase implements org.apache.jasper.runtime.jspsourcedependent { // String name = ; public String getname() { return name; } private static final JspFactory _jspxfactory = JspFactory.getDefaultFactory(); private static java.util.list _jspx_dependants; private javax.el.expressionfactory _el_expressionfactory; private org.apache.annotationprocessor _jsp_annotationprocessor; public Object getdependants() { return _jspx_dependants; } public void _jspinit() { 228

20..29 1: PM ` 229 ntech4 C9600 2400DPI 175LPI T 4.5 _el_expressionfactory = _jspxfactory.getjspapplicationcontext(getservletconfig().getservletcontext()).getexpressionfactory(); _jsp_annotationprocessor = (org.apache.annotationprocessor) getservletconfig().getservletcontext().getattribute(org.apache.annotationprocessor.class.getname()); } public void _jspdestroy() { } public void _jspservice(httpservletrequest request, HttpServletResponse response) throws java.io.ioexception, ServletException { PageContext pagecontext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setcontenttype( text/html; charset=utf-8 ); pagecontext = _jspxfactory.getpagecontext(this, request, response, null, true, 8192, true); _jspx_page_context = pagecontext; application = pagecontext.getservletcontext(); config = pagecontext.getservletconfig(); session = pagecontext.getsession(); out = pagecontext.getout(); _jspx_out = out; out.write( \r\n ); out.write( <!DOCTYPE html PUBLIC \ -//W3C//DTD HTML 4. Transitional//EN\ \ http://www.w3.org/tr/html4/loose.dtd\ >\r\n ); out.write( \r\n ); out.write( \r\n ); out.write( <meta http-equiv=\ Content-Type\ content=\ text/html; charset=utf-8\ >\r\n ); out.write( <title> </title>\r\n ); out.write( \r\n ); out.write( \r\n ); // int number = 1; for (int i =0; i < 5; i++) { out.println(number + : ); out.println(getname() + <br> ); 229

20..29 1: PM ` 230 ntech4 C9600 2400DPI 175LPI T CHAPTER } number++; out.write( \r ); out.write( \n ); out.write( \r\n ); out.write( \r\n ); out.write( ); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out!= null && out.getbuffersize()!= 0) try { out.clearbuffer(); } catch (java.io.ioexception e) {} if (_jspx_page_context!= null) _jspx_page_context.handlepageexception(t); } } finally { _jspxfactory.releasepagecontext(_jspx_page_context); } } } JSP JSP page include taglib include forward plugin usebean setproperty getproperty JSP/ JSP 230