Maintain Session using URL Rewriting

In this method, we rewrite the URL and append the information to the URL to keep the track of the values. URL Rewriting can be used to maintain the session. We can maintain session using URL rewriting.

There are several methods to maintain session between client and server, see all types of method here

Lets see an example

—index.jsp—

How to maintain Session?

 


3.
URL rewriting

Once you click on the URL rewriting link URLRwriting.java class will append p3lang in the URL. See below code of URLRewriting.java

–rewrite.jsp–
This rewrite.jsp page is the response page. This page will display the value that we have sent in the URL.

OUTPUT:

Index page
URL Rewriting
Rewritten URL
URL Rewriting 1

%d bloggers like this: