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 difference between javascript and jsp?

996


What are jsp el implicit objects and how it’s different from jsp implicit objects?

1059


How can I use the results of my method? ea: <%! method (int x) { stuff return y; } %> <% out.println(y); %> how can I make this work? "y" is a variable made during the method.

2178


How does el search for an attribute?

948


How can I prevent the use of scripts and java code on the jsp page?

933


Explain jsp:plugin action?

1059


How do I mix jsp and ssi #include? What is the difference between include directive & jsp:include action?

1100


How do we prevent browser from caching output of my jsp pages?

1016


What is difference between sendredirect and requestdispatcher?

978


How many jsp scripting elements are there and what are they?

1067


How can I override the jspinit() and jspdestroy() methods within a jsp page?

993


What are the different types of jstl tags?

964


What is custom tag library?

907


Why is _jspservice () method starting with an '_'?

888


What is jsp net?

987