473,503 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to check when session is expired while using DOJO

58 New Member
Hi All,

I am having a problem. I am using DOJO toolkits to fetch some data on my webpage. Now suppose if i leave my webpage for some time and the session gets expired and then i try to click on the link which invokes the DOJO(AJAX) call, it tries to re-authenticate and establish a session by itself. But, it then forwards me the authentication JSP as result of DOJO call instead of the intended JSP. PLease let me know how to track if the session has been expired in DOJO calls. Or if you have any solution for this problem.
Note: I using the following
Java Struts/ Dojo toolkit
Jan 5 '08 #1
15 13362
acoder
16,027 Recognized Expert Moderator MVP
Just check if the authentication JSP is returned or you could use another JSP file which returns true or false depending on whether the session has expired or not.
Jan 5 '08 #2
plsHelpMe
58 New Member
Just check if the authentication JSP is returned or you could use another JSP file which returns true or false depending on whether the session has expired or not.
hi acoder,
Actually in my application whenever session gets expired and you try to hit the server, you are autometically authenticated first. Now in my case the application's automatic attempt of authenticating it returns me the code of the jsp which gets displayed just after you login to the application. Its a kind of jsp showing that you are using ssl connection and click on OK to continue.
In order to proceed further i have to click on the ok button on this jsp. I dont know how to do it. I dont want to show this jsp in any div on my page. Moreover if i refresh the page i get the jsp which is having the coding which i utilise when normally return from ajax call. The code of this jsp gets displayed to me.
Jan 9 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
You can display the page in a hidden iframe. Then access the iframe and use the button's click() method.

What does the OK button do? Does it submit a form?
Jan 9 '08 #4
plsHelpMe
58 New Member
You can display the page in a hidden iframe. Then access the iframe and use the button's click() method.

What does the OK button do? Does it submit a form?
Yes the OK buttton submits a form to an Action which creates the entitlements and lots of other things and forward it to the action which is handling my ajax call. That action forward to the jsp which is having some data which i am using in my original jsp
Jan 10 '08 #5
dmjpro
2,476 Top Contributor
Hi All,

I am having a problem. I am using DOJO toolkits to fetch some data on my webpage. Now suppose if i leave my webpage for some time and the session gets expired and then i try to click on the link which invokes the DOJO(AJAX) call, it tries to re-authenticate and establish a session by itself. But, it then forwards me the authentication JSP as result of DOJO call instead of the intended JSP. PLease let me know how to track if the session has been expired in DOJO calls. Or if you have any solution for this problem.
Note: I using the following
Java Struts/ Dojo toolkit
What I understood from your Question that is, you are trying to check whether session expired or not. And that is you are doing through a AJAX call. If AJAX call can successfully determine then it re-authenticates and establishes a new session. Right?
First let me know that. Then show me your code how much you did.

Debasis Jana
Jan 10 '08 #6
acoder
16,027 Recognized Expert Moderator MVP
Yes the OK buttton submits a form to an Action which creates the entitlements and lots of other things and forward it to the action which is handling my ajax call. That action forward to the jsp which is having some data which i am using in my original jsp
If it's a submit button, just make a request to the action page instead with all the POST parameters sent using the send() method.
Jan 10 '08 #7
plsHelpMe
58 New Member
If it's a submit button, just make a request to the action page instead with all the POST parameters sent using the send() method.

Hey buddy,

I am not suppose to touch the JSp behind that OK button
Jan 10 '08 #8
acoder
16,027 Recognized Expert Moderator MVP
Hey buddy,

I am not suppose to touch the JSp behind that OK button
Who said you have to change anything? Just look at what is posted and post that using Ajax. If that doesn't work, post your code from the beginning.
Jan 10 '08 #9
riyaztak
4 New Member
Hi All
I have a problem
I m using dojo to send a request.
But suppose my session has expired and i try to send request;it goes into infinite loop.
So will anyone telll me how to check whether session has expired or not?

I m using Dojo toolkit and jsp.
Thanx
Feb 23 '09 #10
acoder
16,027 Recognized Expert Moderator MVP
In your JSP code, you'll probably have some code which checks whether the user is logged in. If not, it will display the login page. So using that check, you can determine if the session has timed out or not.

If the session has timed out, return false, so in the response from the Ajax call, you can test for that.
Feb 23 '09 #11
riyaztak
4 New Member
Hi
Thnx for reply.
Actually in my application one filter is there which will check whether session is
expired or not.
If i make simple call it works fine but in case on ajax call it goes into infinite loop.

Expand|Select|Wrap|Line Numbers
  1. var bindArg = {
  2.     url:"xyz.action",
  3.     sync:true,
  4.     content:params,
  5.     load:function(type, data, evt) {
  6.        process(data);
  7.    }
  8. };
  9. dojo.io.bind(bindArg);
Feb 23 '09 #12
riyaztak
4 New Member
I have even tried to check status as well using evt.status.

but in case of session expired control doesn't go there
Feb 23 '09 #13
acoder
16,027 Recognized Expert Moderator MVP
When you say it works fine in the case of a simple call, what does it show/return?

You can't check the status property of the XMLHttp object because that's the status of the request.
Feb 24 '09 #14
riyaztak
4 New Member
In case of simple call if session has expired the control will goto login page but in case of ajax call it goes into infinite loop.
Feb 24 '09 #15
acoder
16,027 Recognized Expert Moderator MVP
You have two choices: either make a request to another page which simply returns true or false and check for that, or parse the response and look for login code. If it's there, then that means that the session has expired.
Feb 24 '09 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2935
by: Lenny | last post by:
I have application that uses session variables to preserve data between calls Session expiration time is set to 20 min. Sometimes my users getting error 'Session Expired' even right after they...
1
1803
by: szabelin | last post by:
Hello - (1) is there a way to check that session has expired? (2) My session timeout is set to 20 minutes, but I can leave the client overnight and my session is still on next morning- so when...
0
312
by: uni | last post by:
Hi, We are running asp.net application. Previously, there's no any other problem, but recently, the session expired error bumps out frequently like 10 minutes a time or so. The session timeout...
15
4713
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
1
2543
by: net4matrimonials | last post by:
I m using session veriables of asp.net on two websites www.net4professionals.com(job site) and www.net4matrimonials.com (bride/groom service) when i create a session on page A i use codeing...
6
3316
by: NH | last post by:
How can I warn a user that their session has expired when they click on a button etc?
2
3076
by: fijsolam1981 | last post by:
Hi, I had created a web application where Session expiry was set to 2,000 minutes in IIS. in web config i had given like this <sessionState timeout="2,000" mode="InProc"></sessionStatebut MY web...
5
3654
by: plsHelpMe | last post by:
How to create dynamic javascript arrays using dojo toolkits Hello frens, I am in a big trouble. My objective is: I am having some categories shown by differnent radio buttons, on the click of...
2
1228
KalariaNitya
by: KalariaNitya | last post by:
hi to all, i have index.aspx form as main form..on that form one button GO which redirect to gallary.aspx form.. if i m doing nothing upto one or even less then one minute session goes expired...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.