The Artima Developer Community
Sponsored Link

Java Answers Forum
Session in JSP

3 replies on 1 page. Most recent reply: May 2, 2006 12:00 PM by Risko ja

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Risko ja

Posts: 3
Nickname: risk0
Registered: Apr, 2006

Session in JSP Posted: Apr 21, 2006 5:36 AM
Reply to this message Reply
Advertisement
Hi,
I have succesfully created session in a JSP page.
I put name and pasword in a form in index.jsp and then send it
to login.jsp where I start the session.
In login.jsp I am also using an EJB in which I am
connecting to a database and finding out if an user is
in that database.If he is there , I start the session.
In next page I am trying to logout by using : session.removeValue().It removes the session value but when
I click "back" in the browser,the login.jsp page behaves like the session would be still created.

Could you help me with it please?


Naseem Khan

Posts: 2
Nickname: nakhan81
Registered: Apr, 2006

Re: Session in JSP Posted: Apr 27, 2006 10:33 AM
Reply to this message Reply
On logout don't use removerUser() try this....
...................
HttpSession session=request.getSession(false);
if(session!=null){
session.invalidate();
}
..................

Hope this will work

Waiting for ur reply

Bye

Risko ja

Posts: 3
Nickname: risk0
Registered: Apr, 2006

Re: Session in JSP Posted: May 2, 2006 12:00 PM
Reply to this message Reply
How exactly should I use it.
Here is the code:

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<% if(session.getValue("meno")!=null)
{
session.removeValue("meno");

%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="cele">
<div class="hlavicka"><h1 class="hlavicka">Hlavička</h1></div>
<div class="lave">
<p><a href="index.jsp">Prihlasenie</a></p>
</div>
<div class="prave">

<p>Prave</p>
</div>
<div class="obsah">
<%
out.println("<h2>Bol si odhlaseny</h2>");
%>
</div>

<div class="spodok"></div>
</div>
</body>
</html>
<%
}
else
{
%>
<%@ include file="index.jsp" %>
<%
}
%>

Risko ja

Posts: 3
Nickname: risk0
Registered: Apr, 2006

Re: Session in JSP Posted: May 2, 2006 12:00 PM
Reply to this message Reply
How exactly should I use it.
Here is the code:

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<% if(session.getValue("meno")!=null)
{
session.removeValue("meno");

%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="cele">
<div class="hlavicka"><h1 class="hlavicka">Hlavička</h1></div>
<div class="lave">
<p><a href="index.jsp">Prihlasenie</a></p>
</div>
<div class="prave">

<p>Prave</p>
</div>
<div class="obsah">
<%
out.println("<h2>Bol si odhlaseny</h2>");
%>
</div>

<div class="spodok"></div>
</div>
</body>
</html>
<%
}
else
{
%>
<%@ include file="index.jsp" %>
<%
}
%>

Flat View: This topic has 3 replies on 1 page
Topic: Streams simple Questions??? Previous Topic   Next Topic Topic: Team Coding - Bloody Incompetence***

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use