Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to maintain sessions in jsp?can you tellme the methods.

Answer Posted / tarak

In the state page u have to set the session
<% Session ses=request.getSession(true);%>
Then set an atribute for the session.
<% ses.setAttribute("attribute","valid session");%>

Session: <% =ses.getAttribute("attribute");%>

(It will display Session: valid session)

Before you close or logout invlidate the session and remove
attribute
<% ses.removeAttribute("attribute");
ses.invalidate();%>

Everytime at the start of page we can check for the value
of sesion attribute. If it is set, then the session will be
valid. Otherwise invalid session.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is declaration statement?

971


Explain the difference between include directive and include action in jsp?

949


Can a subsequent request be accessed with one’s servlet code, if a request attribute is already sent in his jsp?

958


What are the life-cycle methods for a jsp?

960


Tell us about the jsp life cycle methods.

926


What is jsp and its advantages?

957


What is the use of jsp and servlet?

891


What is jsp container?

950


How does error handling occur with jstl?

936


What is jsp param?

1091


How are the jsp requests handled?

945


What is the difference between server side and client side programming?

923


How many tags are provided in jstl?

1124


How do we catch exception and process it using jstl?

959


How do you comment out in jsp?

992