Posted on

Servlets and JSP: A crash course (Part 1: The Backbone)

It’s 5AM and I’m still wired on the monster I drank a few hours ago, so I figure I might was well pass the time (season 2 of House is downloading) and write a tutorial on servlets and JSP because I have nothing better to do.

Disclaimer: This is not a hold your hand tutorial, it’s to give you a basic understanding of how this works so you can develop a better development pattern, and code more efficiently.

How HTTP works:

So the first real thing you HAVE to know in order to do anything with server side programming is how the internet works. At face value, all you really know is that the internet is a series of tubes, but really it’s a dense forest of protocols and scripting languages. The backbone of the internet, is HTTP. Hyper Text Transfer Protocol.

So how does HTTP work?

Lets say we tell our browser to go to

Our browser generates an HTTP Request and sends it to the server.

The server gets that request, parses it, and generates an HTTP response, and sends that back to the browser. Our browser parses that response, and renders the HTML or Data that was sent back to it.

The browser will do this for web pages, and links. So every <a href=”… will be requested from the server. Every one.

So there are really two types of HTTP request methods that you are going to use.



An HTTP GET request is basically when the browser wants something from the server. So essentially you’re GETing X.

The cool thing about the GET request is that you can add small parameters to the end of it so you can link to that resource later. An example of this is:

The question mark indicates that there is some data that going to be sent to the server. In this case, a parameter “image” has the value of “servlet”.

HTTP GET requests are only good for sending tiny amounts of data. If you’re sending something that you can’t type yourself, it’s too big and should be POSTed.


The POST method is something you’d use if you’re sending either large, or private data to the server. Things like files, account numbers, and passwords are examples of things you’d probably want to POST. The advantage of POST is that you can send large (almost limitless) amounts of data to the web server, and also that the data is invisible to other users (from the browser at least). One of the really big disadvantages of the POST method however, is that whatever you send to the server can’t be sent again, at least through a  URL. So whatever you send through there, you’ll have to send all over again if you want someone else to see it. That’s no good for things you want people to be able to link each other to.

So this is a basic rundown of HTTP, next I’ll be covering Servlets.


About boringtechie

Hello, I'm the boring techie! So you've landed yourself on this site due to me or someone else linking you here, and you're wondering: "What does this kid do, and why should I even care?" Right? Of course you are. Basically, I'm a Techie, though I'm not as boring as the title says, that's one of those things where the word means the opposite of what's REALLY going on... Anyway, I write tuts and make commentaries. That's about it...

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s