Web Development with Java



Download 1,94 Mb.
Pdf ko'rish
bet8/82
Sana14.07.2022
Hajmi1,94 Mb.
#797363
1   ...   4   5   6   7   8   9   10   11   ...   82
Bog'liq
Web Development With Java

Appendix
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
253
A.1 
Classpath and Packages . . . . . . . . . . . . . . . . . 
253
A.1.1 Usual Suspects . . . . . . . . . . . . . . . . . . 
253
A.1.2 What Is a Package? . . . . . . . . . . . . . . . 
254
A.2 
JAR File Problems . . . . . . . . . . . . . . . . . . . . 
254
A.2.1 Hibernate . . . . . . . . . . . . . . . . . . . . . 
255
A.2.2 MySQL Driver . . . . . . . . . . . . . . . . . . 
256
A.2.3 Hibernate Annotations . . . . . . . . . . . . . 
256
A.3 
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . 
256
A.4 
Auxiliary Classes . . . . . . . . . . . . . . . . . . . . . 
257
A.4.1 Annotations . . . . . . . . . . . . . . . . . . . 
258
A.4.2 Cookie Utility . . . . . . . . . . . . . . . . . . 
258
A.4.3 Enumerations . . . . . . . . . . . . . . . . . . 
259
A.4.4 Helper Base . . . . . . . . . . . . . . . . . . . . 
260
A.4.5 Hibernate Helper . . . . . . . . . . . . . . . . 
268
Contents 
xiii


A.4.6 InitLog4j Servlet . . . . . . . . . . . . . . . . . 
276
A.4.7 PersistentBase Class . . . . . . . . . . . . . . . 
277
A.4.8 Webapp Listener . . . . . . . . . . . . . . . . . 
278
Glossary
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
279
References
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
280
Index
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
281
xiv
Contents


1
Browser – Server Communication
This chapter explains how information is sent from a browser to a server. It begins 
with a description of the request from a browser and a response from a server. 
Each of these has a format that is determined by the 
Hypertext Transfer Protocol 
[HTTP].
The chapter continues with the explanation of markup languages, with a 
detailed description of the 
Hypertext Markup Language
[HTML], which is used to 
send formatted content from the server to the browser. One of the most important 
features of HTML is its ability to easily request additional information from the 
server through the use of hypertext links.
HTML forms are also covered. These are used to send data from the browser back 
to the server. Information from the form must be formatted so that it can be sent 
over the web. The browser and server handle encoding and decoding the data.
Simple web pages cannot process form data that is sent to them. One way to 
process form data is to use a web application and a 
Java Server Page
[JSP]. In a 
JSP, the 
Expression Language
[EL] simplifi es access to the form data and can be 
used to initialise the form elements with the form data that is sent to the page.
JSPs are processed by a program know as a servlet engine. The servlet engine 
receives the request and response data from the web server and processes the 
request from the browser. The servlet engine translates all JSPs into programs 
known as servlets.
Servlets and JSPs must be run from a servlet engine. Tomcat is a popular servlet 
engine. NetBeans is a development environment that is tailored for web develop-
ment. NetBeans is packaged with Tomcat.
1.1 Hypertext 
Transfer 
Protocol
Whenever someone accesses a web page on the Internet, there is communication 
between two computers. On one computer there is a software program know as a 
browser, on the other is a software program known as a web server. The browser 
sends a request to the server and the server sends a response to the browser. The 
request contains the name of the page that is being requested and information 
about the browser that is making the request. The response contains the page that 
was requested (if it is available), information about the page and information 
about the server sending the page – see Figure 1.1.
1


2
Web Development with Java
Browser
Server
GET /index .html HTTP/1.1
[Request Headers ]
[Blank Line ]
[Optional Content ]
Request
Response
200 OK HTTP /1.1
[Response Headers ]
[Blank Line ]

...
Figure 1.1
The request and response have specifi c formats, as specifi ed by the HTTP protocol.
When the browser makes the request, it mentions the protocol that it is using: 
HTTP/1.1. When the server sends the response, it also identifi es the protocol it is 
using: HTTP/1.1. A protocol is not a language; it is a set of rules that must be fol-
lowed. For instance, one rule in HTTP is that the fi rst line of a request will contain 
the type of request, the address of the page on the server and the version of the 
protocol that the browser is using. Another rule is that the fi rst line of the response 
will contain a numeric code indicating the success of the request, a sentence 
describing the code and the version of the protocol that the server is using.
Protocols are used in many places, not just with computers. When the leaders 
of two countries meet, they must decide on a common protocol in order to com-
municate. Do they bow or shake hands when they meet? Do they eat with chop-
sticks or silverware? It is the same situation for computers, in order for the browser 
and server to communicate, they must decide on a common protocol.
1.1.1 Request 
Format
The request from the browser has the following format in HTTP:
1. The fi rst line contains the type of request, the name of the requested page and 
the protocol that is being used.
2. Subsequent lines contain information about the browser and the request.
3. A blank line indicates the end of the request headers.
4. In a POST request, there can be additional information sent after the blank 
line.
1.1.2 Response 
Format
The response from the server has the following format in HTTP:
1. The fi rst line contains the status code, a brief description of the status code and 
the protocol being used.
2. Subsequent lines contain information about the server and the response.


Browser – Server Communication 
3
3. A blank line indicates the end of the response headers.
4. In a successful response, the content of the page will be sent after the blank 
line.
1.1.3 Content 
Type
The server must also identify the type of information that is being sent. This is 
known as the 

Download 1,94 Mb.

Do'stlaringiz bilan baham:
1   ...   4   5   6   7   8   9   10   11   ...   82




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish