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 server side programming language?

912


How can we use beans in jsp?

983


Is jsp compiled?

902


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

960


How can my application get to know when a httpsession is removed?

991


Which attribute specifies a jsp page that should process any exceptions thrown but not caught in the current page?

967


What is expression language in jsp?

1001


What are the types of directives in jsp?

942


What is tld file?

901


What is el in jsp?

939


Which one is better jsp or servlet?

926


Is jsp a front end?

973


How can we forward the request from jsp page to the servlet?

937


How do you prevent the creation of a session in a jsp page and why? What is the difference between include directive & jsp:include action?

1010


Can we use jsp implicit objects in a method defined in jsp declaration?

961