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.

Answers were Sorted based on User's Feedback



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

Answer / manu

A small correction at **


using session oject in jsp.
first u set using following methods
String name="ravi";
session.setAttribute("user",name);

using retrive method
String sessionuser=session.getAttribute("user");**
out.println("welcome"+sessionuser);
u give this last 2 stmts in all jsp pages. it will
display as "Welcome ravi".

Is This Answer Correct ?    123 Yes 33 No

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

Answer / brindha.d

using session oject in jsp.
first u set using following methods
String name="ravi";
session.setAttribute("user",name);
using retrive method
String sessionuser=session.getAttribute(name);
out.println("welcome"+sessionuser);
u give this last 2 stmts in all jsp pages. it will
display as "Welcome ravi".

Is This Answer Correct ?    121 Yes 55 No

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

Answer / sandeep

Using HttpSession. Methods used are getSession(),
setAttribute and getAttribute

Is This Answer Correct ?    76 Yes 17 No

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

Answer / mainuddin

My declarring <%@ page session="true"%>
and setting one variable in request object

like.
<% String name="milu";%>
<% session.setAttribute("name",name);%>

getting this : <%=(String)session.getAttribute("name")%>

Is This Answer Correct ?    61 Yes 11 No

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

Answer / aryan

String name="Arpit";
session.setAttribute("user",name);
String sessionuser=session.getAttribute("user");
out.println("WellGud"+sessionuser);

Is This Answer Correct ?    36 Yes 11 No

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

Answer / mayur patel

start session oject in jsp.

first u set using following methods
String name="Mayur4453";
session.setAttribute("user",name);

using retrive method
String suser=session.getAttribute("user");**
out.println("Hi. . !! welcome "+suser);

Is This Answer Correct ?    19 Yes 8 No

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

Answer / murali mohan rao

first set the value in session using following methods
***Don't create the unnecessary Strings***

<%session.setAttribute("user","Murali");%>

Below statement you can use in any JSP to print the
welcome message. Start using JSP tags to better performance
and better coding.

<%= "Welcome to "+session.getAttribute("user")%>

Is This Answer Correct ?    12 Yes 3 No

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

Answer / murali mohan rao

first set the value in session using following methods
***Don't create the unnecessary Strings***

<%session.setAttribute("user","Murali");%>

Below statement you can use in any JSP to print the
welcome message. Start using JSP tags to better performance
and better coding.

Welcome to <%=session.getAttribute("user")%>

Is This Answer Correct ?    8 Yes 3 No

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

Answer / godfather

String str="xxx";
session.setAttribute("xxx",str);//to set session
//so nw the session will get store by the name "xxx".

//To retrieve session

String str1=session.getAttribute("xxx");

Is This Answer Correct ?    14 Yes 10 No

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

Answer / 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

More JSP Interview Questions

What are the different types of jstl tags?

0 Answers  


Can you disable the caching on the back button of a particular browser?

0 Answers  


In the servlet 2.4 specification singlethreadmodel has been deprecated, why?

0 Answers  


Differentiate between <jsp:include page=…> and <%@include file=…>.

0 Answers  


Why are jsp pages preferred for creating web-based client program?

0 Answers  


What is pagecontext jsp?

0 Answers  


What is difference between jsp and javascript?

0 Answers  


How can I implement a thread-safe jsp page?

0 Answers  


What is the use of 'out' implicit object?

0 Answers  


What are different types of comments in jsp?

0 Answers  


What are action tags?

0 Answers  


Can you disable jsp scripting?

0 Answers  


Categories