... tượng Session. Đối tượng này thuộc lớp HttpSession.
http:/ /java. sun.com/j2ee/sdk _1. 3/techdocs/api/javax/servlet/http/HttpSession.html
1.
1.1. Nhận dạng một phiên làm việc
Mỗi khi có một phiên làm ... server ứng với jspsample có phần HTTP Port là 810 1,
sau đó trên http, bạn gõ http://localhost: 810 1/test.jsp, kết quả sẽ xuất hiện như hình 1- 8.
Hình 1- 8: Kết quả trang test.jsp
Giáo viên: Phạm ... thường: str1.toLowerCase();
Từ thường saung hoa: str1.toUpperCase();
Ví dụ
<%
String str1=”Select * from tblemplyors”;
str1=str1.toLowerCase();
out.println(“LowerCase is ” + str1);
...
... (2
(4
(3
(2
(11
(2 (11
(5
(6
(7
(8
(9
(11
(2
(11
(2
(10
(2
(11
(11 (2
Luận Văn Tốt Nghiệp GVHD: Tô Văn Nam
<html>
<%
mã Java
%>
</html>
Ví dụ: <html>
<% // Dưới đây là mã lệnh java
out.println(“The ... 14
KHÁCH HÀNG
Tìm
Liệt
SẢN PHẨM
GIỎ HÀNG
QL.Sản phẩm
ADMINKHÁCH HÀNG
Đăng ký
KHÁCH HÀNG
QL.Khách hàng
ADMIN
Tạo đơn hàng
ĐƠN HÀNG
ADMIN
(1
(2 (3 (4
(1 (2
(4
(3
(2
(11
(2 (11
(5
(6
(7
(8
(9
(11
(2
(11
(2
(10
(2
(11
(11 (2
Luận ... Giới thiệu về ngôn ngữ Java …………………………………………… 39
IV. JSP ( JavaServerPages ) …………………………………………………46
V. Truy xuất cơ sở dữ liệu trong JSP …………………………………………52
VI. Jrun Web Server …………………… …………………………….………53
Chương...
...
Programs | JRUN 4.0 | JRUN Default Server hay JRUN Admin Server roi sau do khởi
động JRUN Default Server, phần này sẽ trình bày trong phần cấu hình.
1. 3.
1. 3 .1.
1. 3.2.
Cấu hình ứng dụng JSP
Để ...
cho người sử dụng như hình 1- 9.
Hình 1- 10: Quá trình biên dịch trang JSP
Tập tin
JSP
Web
Server
Java
Engine
(JSK)
Tập tin
Java
Servlet
Tập tin
Class ... LEARNING CENTERWWW.HUUKHANG.COM
Môn học: JavaServerPages
Bài 1
Những vấn đề chính sẽ được đề cập trong khoá học:
9 Cài đặt JRUN.
o Cài đặt JDK1.3.
o Cài đặt JRUN.
o Cấu hình ứng dụng...
...
char char1[]=str1.toCharArray();
Chuyển chuỗi sang mảng
<%
String str1=”Select * from tblemplyers”;
char char1=str1.toCharArray();
out.println(“Char of Str1 [1] is ” + char1[5]);
...
Hình 1- 7: Tên site vừa tạo
Xem trên bảng danh sách server ứng với jspsample có phần HTTP Port là 810 1,
sau đó trên http, bạn gõ http://localhost: 810 1/test.jsp, kết quả sẽ xuất hiện như hình 1- 8. ...
str1=str2.replace(“’”,”’’”);
str1=str2.replace(“a”,”k”);
Ví dụ khai báo thay thế chuỗi
<%
String str1=”Select * from tblemplyurs”;
str1= replaceString (str1,“u”,”o”);
str1= replaceString...
... dụng.
5
Kiến trúc của Java
•
Java Platform
•
Java Virtual Machine (Java VM)
•
Java Application Programming Interface (Java API)
Hardware-Platform
Java VM
Java API
myProgram .java
Java Platform
Mã nguồn
3
Giới ... viện khác như
JSP, JavaMail, Java TAPI…
•
19 95: Version JDK 1. 0
•
19 98: Version JDK 1. 2 (Java 2
nd
Platform)
•
2004: Version JDK 1. 5
4
Giới thiệu ngôn ngữ Java
•
Đặc điểm của Java
•
Đơn giản
•
Hướng ... thiệu ngôn ngữ Java
•
Lịch sử phát triển của Java
•
Ra đời tại Sun Microsystems bởi James Gosling
•
19 91: Version đầu tiên với tên “Oak”
• 19 95: Tên chính thức là Java
•
Mục đích của Java
•
Dùng...
... static …
}
Hello .java
Biên dịch
Thông dịch
Hello.class
(bytecode)
javac Hello .java
java Hello
010 010 11
6
Kiến trúc của Java
•
Java Development Kit – JDK
• Bộ công cụ phát triển Java (jdk) gồm ... ra còn một số thư viện khác như
JSP, JavaMail, Java TAPI…
• 19 95: Version JDK 1. 0
•
19 98: Version JDK 1. 2 (Java 2
nd
Platform)
•
2004: Version JDK 1. 5
18
Các toán tử
= > < ! ~
?: == <= ... số lẻ từ 1 đến 10 0
int tong = 0, i = 1;
while (i< =10 0)
{
tong+=i; i+=2;
}
System.out.println(tong);
5
Kiến trúc của Java
•
Java Platform
•
Java Virtual Machine (Java VM)
•
Java Application...
... different Java technologies that allow us to build
dynamic web pages: Servlets, JavaServerPages (JSPs) and JavaScript.
• Servlets are Java programs that run on a web server and build web
pages ...
more efficient.
• JavaServerPages simplify the building of dynamic html web pages
by allowing the programmer to insert Java directly into regular HTML
pages.
• JavaScript is a Java technology ... environment.
JavaScript
Note that JavaScript may be included in pages dynamically prepared by a JSP or Servlet on the
server.
6. Networking documents and databases - 4. Dynamic websites: JavaServer Pages...
... not
empty
Operators
Empty
LogicalRelational
Arithmetic
Example
48
21/ 07/2009
1
Java Server Pages
http://www.vovanhai.wordpress.com
1
JSP Basics
2
JSP
JavaServer Page (JSP) is a server side script language
Saved with ... formatting messages
MessageFormat
MessageFormat.Field
21/ 07/2009
11
The sql:transaction Tag
61
62
Internationalization(I18N)
63
I18N Basics (1)
64
Internationalization
The method of designing ...
taglib - Enables the use of custom tags in the
JSP page
10
page Directive
11
include Directive
12
21/ 07/2009
3
taglib Directive
13
Standard Actions
Tags affecting the behavior of JSP at...
... continue
Adding JavaBeans to JavaServer Pages
Now that we understand what JavaBeans are and how they are commonly used, let's take a look at
embedding them into JavaServer Pages. In the ...
Listing 3.2: SimpleJavaBeanTester .java
import java. io.*;
public class SimpleJavaBeanTester {
public SimpleJavaBeanTester() {
}
public void storeBean(SimpleJavaBean value) {
try ... servlets.
Listing 2 .1: BasicServlet .java Displays the Request Method Used by the Client
import javax.servlet.*;
import javax.servlet.http.*;
import java. io.*;
import java. util.*;
public...
...
Programs | JRUN 4.0 | JRUN Default Server hay JRUN Admin Server roi sau do khởi
động JRUN Default Server, phần này sẽ trình bày trong phần cấu hình.
1. 3.
1. 3 .1.
1. 3.2.
Cấu hình ứng dụng JSP
Để ...
huukhang@yahoo.com 3 -1
COMPUTER LEARNING CENTERWWW.HUUKHANG.COM
3. Chọn vào menu Home, JRUN sẽ liệt kê danh sách các server đang cấu hình trên
JRUN như hình 1- 4.
Hình 1- 4: Danh sách các Server trên ... "+intArray[0]+" "+intArray [1] );
out.println("Object[2]: "+objectArray[0]+" "+objectArray [1] );
%>
4. CÁC PHƯƠNG THỨC VÀ PHƯƠNG THỨC TRONG JAVA
4 .1. Phương thức trả về...
... servlets.
Listing 2 .1: BasicServlet .java Displays the Request Method Used by the Client
import javax.servlet.*;
import javax.servlet.http.*;
import java. io.*;
import java. util.*;
public ... they can be used in JSPs.
Chapter 2: Java Servlets
Overview
JavaServer Pages are extensions of Java servlets, therefore, you really need to understand Java servlets
before you can fully grasp ... super.init(config);
}
- 18 -
The Java Servlet Architecture
Two packages make up the servlet architecture: the javax.servlet and javax.servlet.http
packages. The javax.servlet package contains...
...
Chapter 3: JavaBeans and JSP Concepts
Overview
Before we can start learning about how you can use JavaBeans in JavaServer Pages, we must take a
look at what a bean is. A JavaBean is a 10 0% Java ...
Chapter 3: JavaBeans and JSP Concepts
Overview
Before we can start learning about how you can use JavaBeans in JavaServer Pages, we must take a
look at what a bean is. A JavaBean is a 10 0% Java ... Listing 3 .1
contains
a simple JavaBean.
Listing 3 .1: SimpleJavaBean .java
import java. io.Serializable;
public class SimpleJavaBean implements java. io.Serializable{
private String simpleProperty...
... continue
Adding JavaBeans to JavaServer Pages
Now that we understand what JavaBeans are and how they are commonly used, let's take a look at
embedding them into JavaServer Pages. In the ... (short for Java Database Connectivity) interface is a pure Java API used to execute SQL
statements. This chapter will introduce the JDBC and then explore how to use it in JavaServer Pages.
The ... that page's page directive has the session
attribute set equal to false (see Table 1.1
in Chapter 1) . References
to the session objects will be released after their associated sessions...