Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 5th, 2008, 08:43 AM
Authorized User
 
Join Date: Mar 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to refresh a part of a webpage

Hello everyone,

I need to check if the user has logged in everytime some action takes place on the page.Eg when a user clicks on the page.This is the javascript function I have.

function bodyClick() {
var value=document.getElementById('Bcheck').value;
alert (value) ;
}

I am calling this function from <body onclick="bodyClick()">

and this is the element 'Bcheck'

<h:inputHidden id="Bcheck" value="#{userBean.loggedIn}"/>

When I use this, the value is fixed once the page loads.So even when a user clicks on the page after session times out,the value is still true.So is there anyway I can include the hidden field in a <div> and refresh only the <div> using javascript?

Thanks in advance

 
Old June 5th, 2008, 03:17 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi SBKumar!!
Hope this link will help you http://p2p.wrox.com/topic.asp?TOPIC_ID=69088
Note:- 1>Please verify your session timeout period ,for some server it is modified by Admin,cross check it(modify sessionTimeOutInMin=60) in given code.
     2>You will have to modify alert('Finally TimeOut') line in given link,that will set the Flag/Value to false.
     3>In body click function you need to check the Flag/Value if it is false,then session is completely timed out..

One more thing "How to refresh a part of a webpage "?? for this you need to use ajax/iframe/frame concepts based on ur requirement.With your above requirement its a client side session tracking..and why do u want to refresh part of the page for this?? So be more on problem/solution specific..

Cheers :)

vinod
 
Old June 6th, 2008, 11:25 AM
Authorized User
 
Join Date: Mar 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Vinod

Thanks for the reply.
I am trying to check if the user has logged in so that I can redirect to home page if he is not logged in.I used the alert just to check true/false.I tried looking at frames and AJAX but no where I was able to find the solution to my problem because I cant access the java bean using AJAX.Any help?



 
Old June 6th, 2008, 11:28 AM
Authorized User
 
Join Date: Mar 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

"and why do u want to refresh part of the page for this?? "

I wanted to refresh that particular part so that I get true/false athe moment the event (clicking) occured.If not it holds the same value which was assigned when the page was loaded.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh part of page using Ajax . sbashetti ASP.NET 2.0 Professional 3 October 3rd, 2007 06:46 AM
Refresh GridView Using Refresh Button msbsam ASP.NET 2.0 Professional 0 December 6th, 2006 05:57 AM
e-mail a webpage rylemer Classic ASP Professional 5 July 11th, 2006 08:05 PM
To Load a webpage Nitu kumar RSS and Atom 0 April 3rd, 2006 04:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.