1 1 3 1.1 Web............................ 3 1.2 Servlet/JSP.................................. 3 2 JSP 7 2.1................................... 7 2.2..



Similar documents
Servlet JSP JSP Servlet/JSP における 日 本 語 の 処 理 - 1

メディプロ1 Javaサーブレット補足資料.ppt

II 1 p.1 1 Servlet 1.1 Web Web WWW HTML CGI Common Gateway Interface Web HTML Web Web CGI CGI CGI Perl, PHP C JavaScript Web CGI HTML 1.2 Servlet Java

HTML Java Tips dp8t-asm/java/tips/ Apache Tomcat Java if else f

Web 1 p.2 1 Servlet Servlet Web Web Web Apache Web Servlet JSP Web Apache Tomcat Jetty Apache Tomcat, Jetty Java JDK, Eclipse

Part1 159 a a

HTML Java Tips dp8t-asm/java/tips/ Apache Tomcat Java if else f

9iAS_DEV.PDF

HTTP Web Web RFC2616 HTTP/1.1 Web Apache Tomcat (Servlet ) XML Xindice Tomcat 6-2

スライド 1

Web JavaScript Java Applet Flash ActionScript CGI (C, perl, ruby ) PHP Servlet, JSP (JavaServer Pages) ASP 7-2

II 2 p.2 2 GET POST form action URL Aisatsu 2.1 Servlet GET GET : Query String QueryStringTest.java 1 import java.io.ioexception; 2 import java.io.pri

B2-Servlet-0112.PDF

Gartner Day

PowerPoint Presentation

Microsoft PowerPoint - Lecture_3

PowerPoint Presentation

Servlet/JSP ( 作成中 ) 2010 年 x 月 x 日作成 Firebird 日本ユーザー会 Naoyuki Sano 1

"CAS を利用した Single Sign On 環境の構築"

Oracle9iAS Containers for J2EEチュートリアル

untitled

myapp/jsp/ex01.jsp $CATALINA_HOME/work/Standalone/localhost/myapp/jsp (; ) 1 1. ex01.jsp 2 ; 2. () 3. <%! %>

Web Tomcat MapDataManager i

データ構造とアルゴリズム論

Microsoft Word - migrateto10g2.doc

HTML/JSP/Servlet... 7 JSP... 7 Servlet Struts Struts Struts FormBean LoginForm

第13回講義

Oracle9i JDeveloper R9.0.3 チュートリアル

Microsoft PowerPoint - Lecture_2

データ構造とアルゴリズム論

スライド 1

Microsoft PowerPoint - web_and_dm08_servlet2.pptx

はじめに


データ構造とアルゴリズム論

K227 Java 2

PowerPoint プレゼンテーション

Microsoft PowerPoint - servlet1.pptx

目次

XMLアクセス機能説明書

PowerPoint プレゼンテーション

A B C A B C Ctrl (S) 5 A B C 11.2: (F) (A) ( OK ) 3 (E) ( ) (E)

Eclipse 操作方法 (Servlet/JSP 入門補助テキスト)

: : : TSTank 2


Oracle9i JDeveloperによるWebサービスの構築

おらんかにサーバインストールマニュアル_Win

Microsoft PowerPoint asp cgi.pptx

WebOTXマニュアル

WebOS aplat WebOS WebOS 3 XML Yahoo!Pipes Popfry UNIX grep awk XML GUI WebOS GUI GUI 4 CUI

目次

サーブレット (Servlet) とは Web サーバ側で動作する Java プログラム 通常はapache 等のバックグラウンドで動作する Servletコンテナ上にアプリケーションを配置 代表的な Servlet コンテナ Apache Tomcat WebLogic WebSphere Gla

Blojsom におけるクロスサイトスクリプティングの脆弱性

目次

Dec , IS p. 1/60

Java演習(2) -- 簡単なプログラム --

2 Java 35 Java Java HTML/CSS/JavaScript Java Java JSP MySQL Java 9:00 17:30 12:00 13: 項目 日数 時間 習得目標スキル Java 2 15 Web Java Java J

オンラインテスト

(1) <html>,,,,, <> ( ) (/ ) (2) <!DOCTYPE html> HTML5 (3) <html> HTML (4) <html lang= ja > html (ja) (5) JavaScript CSS (6) <meta charset= shift jis >

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

HTML文書の作成

S2Wicketの紹介

FY01H2_SOHO_iAS

目次 * 本資料について * お問い合わせ * SecureAssist Enterprise Portal API 概要 APIについて API 通信の流れ * SecureAssist Enterprise Portal 各 API 説明認証プロジェクトのレポートの取得プロジェクトの一覧の取得ア

intra-mart im-J2EE Framework

Oracle、MS Access または SQL DB と CVP スタンドアロン配備を統合方法

0序文‐1章.indd

Apache Tomcatにおけるクロスサイトリクエストフォージェリ(CSRF)保護メカニズム回避の脆弱性

JavaScriptプログラミング入門

main.dvi

25 About what prevent spoofing of misusing a session information

Java Platform Debugger Architecture Apache JServ Oracle JVM JPDA JVM Tomcat Oracle JVM... 7

目次 第 1 章はじめに... 3 第 2 章ネットワーク設定 DNS の設定 アウトバウンド HTTPS 接続の許可 アウトバウンド SMTP/POP 接続の許可... 4 第 3 章 JDK への追加ライブラリインストール


1: 3 CAS[3] uportal[4] (Web ) 3.1 CAS CAS[3] Yale JA-SIG [5] CAS 1. 2(1) CAS Web (2)CAS ID LDAP 2. 2(3) CAS Web CAS Ticket (4)Web Ticket 3. Ticket Web

m_sotsuron

■サイトを定義する

概要

橡t15-shibuya.kashiwa.ppt

JAVA H13 OISA JAVA 1

方程式を解いてみよう! C++ から PHP + JavaScriptへ

Oracle JDeveloper 10g ADF Creation Date: Jul 07, 2004 Last Update: Jul 08, 2004 Version 1.0


PowerPoint プレゼンテーション

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics;

コンピュータサイエンス 4. ウェブプログラミング

第2回_416.ppt

スライド 1

java_servlet2_見本

Javaと マルチスレッド

CSS

REALV5_A4…p_Ł\1_4A_OCF

untitled

「都市から地方への人材誘致・移住促進に関する調査」

<91498EE88CA D815B2E786C73>

〔 大 会 役 員 〕

橡本体資料+参考条文.PDF

Lecture on

コンピュータサイエンス 1. ウェブの基本

I. EspressReport 100%Java JSP API II. EspressReport Report Designer Report Designer - Report Designer Web Java Web Web Report Designer import java.awt

Transcription:

Servlet/JSP

1 1 3 1.1 Web............................ 3 1.2 Servlet/JSP.................................. 3 2 JSP 7 2.1................................... 7 2.2........................................ 7 2.3.................................. 8 2.4.......................................... 8 2.5 EL......................................... 9 2.6..................................... 10 2.7....................................... 10 3 13 3.1 page......................................... 13 3.2 request........................................ 13 3.3 session........................................ 14 3.4 application...................................... 14 4 15 4.1 out.......................................... 15 4.2 request........................................ 16 4.3 session........................................ 17 4.4 application...................................... 18 4.5 response....................................... 19 5 Tomcat 21 5.1.................................. 21

2 5.2 Servlet/JSP.............................. 22 5.3 web.xml....................................... 23 5.4 context.xml..................................... 24

3 1 1.1 Web Web Web. Web HTTP, HTML XML. Web, /. Web,., (HTML XML ). 1.2 Servlet/JSP Web Java. Servlet Java HTML, JSP HTML Java.

4 1 public class SampleServlet extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { response.setcontenttype( text/html; charset=utf-8 ); PrintWriter out = response.getwriter(); out.println( <html> ); out.println( <head> ); out.println( <title>loop </title> ); out.println( </head> ); out.println( <body> ); for (int i=1; i<=5; i++) { out.print( <p> ); out.print( i ); out.println( </p> ); } out.println( </body> ); out.println( </html> ); } } Servlet @ page language= java @ page contenttype= text/html; charset=utf-8 <html> <head> <title>loop </title> </head> <body> for (int i=1; i<=5; i++) { <p>= i </p> } </body> </html> JSP <html> <head> <title>loop </title> </head> <body> <p>1 </p> <p>2 </p>

1.2. Servlet/JSP 5 <p>3 </p> <p>4 </p> <p>5 </p> </body> </html> HTML

7 2 JSP HTML.jsp JSP ( ). Java,. 2.1 JSP.. @ 1= 1 2= 2...., UTF-8 HTML. @ page contenttype= text/html; charset=utf-8 2.2!,,.. @ page language= java @ page contenttype= text/html; charset=utf-8! // // int count = 0;

8 2 JSP // 1 count++; <html> <head> <title> </title> </head> <body>= count.</body> </html> (test01.jsp) 2.3, JSP Java. JSP, if while.,. @ page language= java @ page contenttype= text/html; charset=utf-8 // // int count = 0; // 1 count++; <html> <head> <title> </title> </head> <body>= count.</body> </html> (test02.jsp) 2.4 = (Expression),.

2.5. EL 9 @ page language= java @ page contenttype= text/html; charset=utf-8 // String str = ; java.util.list<string> list = new java.util.arraylist<string>(); list.add( ); list.add( ); session.setattribute( list, list); java.util.map<string, String> map = new java.util.hashmap<string, String>(); map.put( str1, ); map.put( str2, ); request.setattribute( map, map); <html> <head> <title> </title> </head> <body> [= str ]<br /> [= 2 * 5 ]<br /> [= ((java.util.list<string>)session.getattribute( list )).get(0) ]<br /> [= ((java.util.map<string, String>)request.getAttribute( map )).get( str1 ) ] </body> </html> (test03 1.jsp) 2.5 EL ${ } EL (Expression Language), ( ). JSP2.0. @ page language= java @ page contenttype= text/html; charset=utf-8 // String str = ; pagecontext.setattribute( str, str); java.util.list<string> list = new java.util.arraylist<string>(); list.add( ); list.add( ); session.setattribute( list, list); java.util.map<string, String> map = new java.util.hashmap<string, String>(); map.put( str1, );

10 2 JSP map.put( str2, ); request.setattribute( map, map); <html> <head> <title>el </title> </head> <body> [${ pagescope.str }] [${ str }]<br /> [${ 2 * 5 }]<br /> [${ sessionscope.list[0] }] [${ list[0] }]<br /> [${ requestscope.map.str1 }] [${ map.str1 }] </body> </html> (test03 2.jsp) 2.6.. < 1= 1 2= 2... > </ > < 1= 1 2= 2... />., to.jsp. <jsp:forward page= to.jsp /> 2.7 - - - -,. // /* */,.

2.7. 11 /* out.println( ); */ - - out.println( ); - -

13 3,.,.. 3.1 page JSP. JSP.. 3.2 request HTTP. 1) 2) Servlet JSP 3) HTTP. Servlet JSP page, forward.

14 3 3.3 session PC.,. HTTP, Cookie URL PC,. 3.4 application Web.,.

15 4 JSP... 4.1 out..,.. @ page language= java @ page contenttype= text/html; charset=utf-8 <html> <head> <title> -out-</title> </head> <body> 3.<br /><br /> <br /> out.print( <br /> ); = <br /> </body> </html> (test04.jsp)

16 4 4.2 request, Cookie HTTP. request.. @ page language= java @ page contenttype= text/html; charset=utf-8 <html> <head> <title> -request-</title> </head> <body> <form action=./test06.jsp method= post > <input type= text name= loginname /> <input type= submit value= /> </form> </body> </html> (test05.jsp) @ page language= java @ page contenttype= text/html; charset=utf-8 // request.setcharacterencoding( UTF-8 ); // String name = request.getparameter( loginname ); <html> <head> <title> -request-</title> </head> <body>

4.3. session 17! = name. </body> </html> (test06.jsp) 4.3 session session.. @ page language= java @ page contenttype= text/html; charset=utf-8 // session Integer count = (Integer)session.getAttribute( COUNT ); if(null == count) { count = Integer.valueOf(0); } // 1 count = Integer.valueOf(count.intValue() + 1); // session session.setattribute( COUNT, count); <html> <head> <title> -session-</title> </head> <body> test08.jsp <br /> = count.intvalue(). </body> </html> (test07.jsp)

18 4 @ page language= java @ page contenttype= text/html; charset=utf-8 // session Integer count = (Integer)session.getAttribute( COUNT ); if(null == count) { count = Integer.valueOf(0); } // 1 count = Integer.valueOf(count.intValue() + 1); // session session.setattribute( COUNT, count); <html> <head> <title> -session-</title> </head> <body> test07.jsp <br /> = count.intvalue(). </body> </html> (test08.jsp) 4.4 application application.. @ page language= java @ page contenttype= text/html; charset=utf-8 // application Integer count = (Integer)application.getAttribute( COUNT ); if(null == count) { count = Integer.valueOf(0); } // 1 count = Integer.valueOf(count.intValue() + 1);

4.5. response 19 // application application.setattribute( COUNT, count); <html> <head> <title> -application-</title> </head> <body> test10.jsp <br /> = count.intvalue(). </body> </html> (test09.jsp) @ page language= java @ page contenttype= text/html; charset=utf-8 // application Integer count = (Integer)application.getAttribute( COUNT ); if(null == count) { count = Integer.valueOf(0); } // 1 count = Integer.valueOf(count.intValue() + 1); // application application.setattribute( COUNT, count); <html> <head> <title> -application-</title> </head> <body> test09.jsp <br /> = count.intvalue(). </body> </html> (test10.jsp) 4.5 response. out, out, response. Cookie.

20 4. @ page language= java @ page contenttype= text/html; charset=utf-8 // // ( ) Cookie cook = new Cookie( test key, test value ); cook.setmaxage(-1); // response.addcookie(cook); <html> <head> <title> -response-</title> </head> <body>cookie.</body> </html> (test11.jsp)

21 5 Tomcat Servlet JSP. Jakarta, Apache Tomcat Project. Apache License, Version2.0. Web,. 5.1 Tomcat.. bin Tomcat common conf

22 5 Tomcat logs webapps work JSP java/class, webapps. webapps. 5.2 Servlet/JSP META-INF. WEB-INF,. classes, jar lib, web.xml,. html js, css JSP..,. 1 war jar war..

5.3. web.xml 23 jar cvf c : v : f : D:Y=app1, C:Y=> D: D:Y=> cd app1 D:Y=app1> dir 2010/04/01 10:00 <DIR> META-INF 2010/04/01 10:00 214 index.jsp 2010/04/01 10:00 1,011 file2.jsp 2010/04/01 10:00 <DIR> WEB-INF D:Y=app1> jar cvf app1.war * D:Y=app1> app1.war. 2 webapps war webapps. 3 Tomcat %CATALINA HOME%/bin/startup.bat Tomcat. #%CATALINA HOME% Tomcat 4 http://127.0.0.1:8080/app1/ 5 Tomcat %CATALINA HOME%/bin/shutdown.bat Tomcat. 5.3 web.xml. filter( ) listener(

24 5 Tomcat ), context-param( ). Servlet,. <web-app> <servlet> <servlet-name>testservlet</servlet-name> <servlet-class>package.testservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>testservlet</servlet-name> <url-pattern>/test.do</url-pattern> </servlet-mapping> </web-app> servlet servlet-name Servlet ( ) servlet-class Servlet servlet-mapping servlet-name URL Servlet url-pattern URL, /test.do, package.testservlet( dopost do- Get). 5.4 context.xml Web.. <Context> <! > <Resource name= jdbc/ossmc auth= Container type= javax.sql.datasource factory= org.apache.commons.dbcp.basicdatasourcefactory driverclassname= org.postgresql.driver username= user password= passwd

5.4. context.xml 25 url= jdbc:postgresql://127.0.0.1:5432/db name maxactive= 10 maxidle= 5 maxwait= -1 /> </Context>

27 2.1 http://creativecommons.org/licenses/by/2.1/jp/legalcode