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.
A java based windows application which required id & pass in starting.
- 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.
- 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
- When you call a function and pass some values to it, you call it as “parameter”.
- 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.
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
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.