facebook twitter youtube
by Amit Gupta - no comments

If you are a windows application developer then working with web application may fear you a bit. But if its concept, syntax, purpose of use etc. sets to your mind properly then you can soundly say that it is childish step to move ahead.

I am preparing a very funny video tutorial over servlets now days. And I hope to publish it soon. Till the period, this tutorial can help you to understand why & how we use servlet. And how we can develop J2EE applications easily.

Consider

A java based windows application which required id & pass in starting.

login screen

  1. Compare Input data against the id & pass stored into DB or written in a file. Or maybe you hard-coded it somewhere in your application.
  2. A class or function you use to check login id & pass say validUserCheck() or loginCheck(). You would have to pass both input values as parameter.

Points to be noticed

  1. When you call a function and pass some values to it, you call it as “parameter”.
  2. Hard coding values in your application, is not a good programming practice. It requires recompilation when that value is changed.

Migrate to J2EE

In web applications, whatever you want to display is written onto webpages say html or JSP. And the java classes containing functions and programming logic are called as SERVLET.

But

Actual name of servlet is kept hidden from outsiders. So a list is prepared which keeps entry of all servlets we designed along with their alias name. This file is called web.xml


java j2ee web.xml

About Servlet

Servlet is ordinary java class which handles all request and response so. There can be N number of java classes in our applications which are being used for different purpose but not to handle requests. These classes are called POJO. Besides handling request and response, servlet is just a java class.


Flow of J2ee servlet web application

Keep reading other parts
You may have refer sample servlet, web.xml and webpage till then.

Amit Gupta

Hey! this is Amit Gupta (amty). By profession, I am a Software Eng. And teaching is my passion. Sometimes I am a teacher, as you can see many technical tutorials on my site, sometimes I am a poet, And sometime just a friend of friends...

Leave a Reply

captcha