| Author |
page attribute tag for session?
|
Sam Doder
Ranch Hand
Joined: Feb 06, 2008
Posts: 204
|
|
Hi, I am learning about sessions and I want to know what session="true" or session="false" is for and if it is required to maintain a session state.
<%@page language="java" session="true" %>
Do I need this in every page where I use a session varible a cross many pages?
Thanks for any help
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
|
This determines whether the page will participate in the session or not. It defaults to true. I've never put this directive on a JSP page in my 10 years of using JSP.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Omar Al Kababji
Ranch Hand
Joined: Jan 13, 2009
Posts: 357
|
|
as you know JSP's are translated to servlets and then the servlets are compiled ... bla bla bla (the life cycle of a JSP file)
and in each JSP there are some implicit objects that you can use such as (session, request, response, out ... etc), those objects are created by default in Servlet that gets generated from the JSP. and if you look in the code generated from the translation of your JSP file you should see somewhere this line of code
which creates the JSP implicit "session" object that you can use in your page, if in someway you don't want that that object gets initialized you set the session parameter in the page directive to false so it will not be generated. to clarify more this point if you try to write the following expression in a JSP (test.jsp) :
and you deploy your application and request the test.jsp you will always get a true.
hope you got it ;)
(peace)
|
Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
|
 |
Sam Doder
Ranch Hand
Joined: Feb 06, 2008
Posts: 204
|
|
Ok , so it is only if I wanted to exclude a page from being part of a session.
Just curious
if I had a page with
<%@page language="java" session="false" %>
Then I do try to use session varable what will it do ?
And could I have to different sessions at the same time over my jsp pages?
Thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
1) Try it and see.
2) No.
|
 |
Sam Doder
Ranch Hand
Joined: Feb 06, 2008
Posts: 204
|
|
Ok , I am at work .
Working for the first time with sessions my boss wants me to figure out a problem with this session stuff.
What is happening is we are using jetty application server.
Whenever we change the password. And try to login in with the new password it won't let us.
We still have to use the old password. Until we shutdown the server an restart it.
I know the password is being stored properly in the mysql database when the use click save new password button.
The problem is when he clicks log out and goes back into the login page and types the new password it won't work. But the old password works until we shutdown the server. How is this even possible the old password isn't even in the data base.
Is something caching the old password I am using <form id="form-login" name="login" method="post" action="j_security_check" >
could this be caching the old password or doing something werid. I would think it would be using the current thing stored in the database?
And on top of all this my boss is pushing me to figure this out. AAAAAAAAAAA H
|
 |
Sam Doder
Ranch Hand
Joined: Feb 06, 2008
Posts: 204
|
|
Figured it out for anybody that wants to know or is working with jetty application server.
You must set the cachetime = 0 by default it is 300.
This is why I would get an error even though the password was different in the database.
Also you obviously need session.invalidate() on your logout page hope this helps somebody.
With my similar problem it to all day to figure it out :lol:
|
 |
RaviNada Kiran
Ranch Hand
Joined: Jan 30, 2009
Posts: 528
|
|
jsp has been into market since 2004
|
If you want something you never had do something which you had never done
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
RaviNada Kiran wrote:jsp has been into market since 2004
Incorrect. I was using an early version of JSP (0.9.2 or something like that, where the <jsp:userBean> tag was still <bean>) in 1998. Please go roll your eyes at someone else.
|
 |
 |
|
|
subject: page attribute tag for session?
|
|
|