Skip to main content

CS8661 - Internet Programming Lab - Experiment 4

Experiment 4 Problem Statement

  1. Write programs in Java using Servlets:
    • To invoke servlets from HTML forms
    • Session tracking using hidden form fields and Session tracking for a hit count

Invoking Servlets from HTML Forms

AIM

To write a Java Servlet program to invoke HTTP servlets from the HTML forms.

ALGORITHM

  1. Create a new project(Java Web) in Netbeans IDE.
  2. Create a new servlet by clicking on file->new->servlet.
  3. Call the HTTP servlet program inside the index.html page using form tag.
  4. Run the program and display the details entered in the HTML form in new HTML page using servlets.

Program

Experiment 4 - Invoke Java Servlets from HTML Forms

Session Tracking using Hidden Form Fields

AIM

To write a JAVA Servlet program for session tracking using hidden form fields.

ALGORITHM

  1. Create a HTML form with hidden input type field.
  2. Create a Servlet Page which reads all the values from the HTML form including hidden input field.
  3. Display the form details in the new HTML page.

Program

Experiment 4 - Session Tracking using Hidden Form Fields