Introduction to Servlet & JSP

Introduction to Servlet & JSP
------------------------------------

As we did in our previous summary, we will begin by learning some new vocabulary about Servlet and JSP:

-Servlet: Java programming language class used to extend the capabilities of servers that host applications accessed via a request-response programming model
-JSP: Java Server Page helps developers to do dynamic web pages based on HTML or XML
-HTML: HyperText Markup Language
-CGI: Common Gateway Interface, here we still don’t need to understand much about it, we just take it as it is.
-GUI: Graphical User Interface
-URL: Uniform Resource Locator
-MIME TYPE: Is the content-type response header’s value
-404 Not Found: Common error when the server can’t find what it thinks you asked for.


The problem which makes us learn and use Servlet and JSP is that we find that if we need more people to use our applications it have to be accessed thought the internet, and as we know the web browsers use the HTML language to read and send message by HTTP protocol (Protocol used under TCP/IP, for more information….”WIKIPEDIA”). The next problem was how to make those HTML pages be dynamic. The solution to all of that was Servlet, which is a Java programming language class which is use to add servers capabilities through request-response to get and give changeable data, JSP which could write java code into a HTML file.

But we still ask ourselves, what is the process? How all these process are going on?
The process is that our browser will send a request (by the URL) to the server asking it to give back a file, an html, a PDF, etc… The server will answer through the HTTP the response on the form of an HTML file. The request stream will be containing the HTTP method to be performed (doGet(), doPost(), or others), the page to be accessed (URL) and the parameters. The Response stream will be containing a status code which will determine if the request was successful or not, the content-type (if it is a PDF, an HTML or others) and at the end the content.

What is the difference between doGet() and doPost()?
doGet() will only go to find something back to the server while doPost() will do so and give also some data to the server. This is the case of login that our username and password must be given to the server to guaranty if it is the right user.

At the end let's talk about the URL and it’s part.
Here is an example of URL: http://localhost:8080/ServletTest/Sample/index.html

-HTTP:// is the Protocol which tell the server which communication protocol will be used
-“localhost” is the Server, the unique name of the physical server which can be replaced by an IP address.
-“/ServletTest/Sample” is the path of to the location on the server of the resource being requested.
-“index.html” is the resource name, the name of the content being requested. It can be a PDF, a picture, a music, a movie, etc…
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值