Login Example – JSP and Servlets: Part I.

Hello Friends,

This is one of the tutorials on JSP and Servlets. In this we will discuss and create a simple login application using servlets and JSP where we will connect to the DB for the user credentials and then authenticate the users accordingly. First of all we will discuss about what we will need for this.

JSP Pages:

We will create three JSP pages which will be the only viewable parts of our code. The three pages will be as Login Page, Login Success page and the Invalid Login page. Continue reading “Login Example – JSP and Servlets: Part I.”

Simple validation in javascript.

Hello Friends,

This is one of the simple code example for validation in javascript. By using the following code, we can make certain input field as a mandatory i.e. one cannot proceed until and unless there is certain value in the required field. In this example we use the simple login screen where we are making the field Username as mandatory. Continue reading “Simple validation in javascript.”

HTML Hidden Fields.

Hello Friends,

I welcome you to my tutorial for hidden field. This control enables a developer to store a non-displayed value in the rendered HTML of the page. The Hidden Field control is used to store a value that needs to be persisted across multiple postbacks to the server. Hidden fields are similar to text fields, with one very important difference. The difference is that the hidden field does not show on the page. Therefore the visitor can’t type anything into a hidden field, which leads to the purpose of the field, to submit information that is not entered by the visitor.

A hidden HTML field is used to pass along variables without  values from one form to another page without forcing the user to re-enter the information. For example, in the case of form submission it may be required that certain information has to be submitted each time the form is submitted. And the information to be submitted is common all the time, then in this case it must be the concern of the developer to make that field Hidden since the developer knows its value and the user need not to fill the field all the time.

When dealing with forms you will usually find yourself using some sort of database mechanism such as MySQL, SQL Server, Oracle or maybe just a plain text file. In such cases use hidden fields in your form to pass along information to your database that you may have already been received from the user or you know the exact value to be submitted.

Consider the following code:

Here in this case the form contains three fields, among them only two fields are visible. But when the form is submitted the values from three fields will be stored into database. Since I know that the language for all the users will be English, I’ve made that field hidden and saved that value along with othre data from the form.

The visual output for the above code will be as follows:

And the main advantage of this is that it can be used in all the HTML supported scripting languages such as PhP, ASP ,JSP etc.


Nikhil Naoghare.