tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Sophinos <tomcatu...@itv-tech.com>
Subject Re: forcing a jsp page to reload/refresh when backend data changes
Date Wed, 15 Jan 2003 12:20:59 GMT
Adding to Justin's method, you can make this polling a more subtle event
by placing a polling jsp page in a frameset with your jsp page, but have
the polling page take up no visible space.

So in effect you divide it into 2 pages: the original data diplay page and 
an invisible "polling" page that only check to see it the datasource has
changed (by getting a rowcount, for example).  

The polling jsp will poll the data source a a given time interval
and if the data has changed, the polling page can use javascript
to force the data display page to resubmit to ge the new data.

This way you have 2 advantages:

1) The polling page just check to see if the data has changed and
does not bring back the entire data set every time

2) the data display page only resubmits back to the datasource
only when the datasource has changed. 

- Nick






On Tue, 14 Jan 2003, Justin Ruthenbeck wrote:

> 
> Hi Jeff --
> 
> Once your jsp outputs its data, its job is done and
> there is no opportunity for it to update anything.
> The only way data can be updated is if the client
> requests it, which means you'll have to force the
> client to refresh.  If it's a browser, set the
> appropriate header or include the correct HTML
> tag (I don't know the currently "best" way to do this,
> but you specify how often you want to refresh and the
> URL to get -- google for "HTTP-EQUIV=Refresh").
> This is only an approximation of what you're trying to
> do ... if you want live communication between server
> and client, you'll need something on the client to
> listen to the socket (and applet would work) and act
> accordingly.
> 
> Hope that's enough to get you going... let me know if
> you need more specifics.
> 
> justin
> 
> 
> At 11:08 AM 1/14/2003, you wrote:
> >Hello!
> >
> >Forgive this very newbie-ish question. If someone
> >could point me in the right direction I would
> >appreciate it.
> >
> >Is it possible/feasible to have .jsp page refresh the
> >data it's displaying when the data on the backend
> >changes? For example if I have a .jsp page that
> >queries and displays data from a database, can the
> >page be coded to monitor the data and when it changes,
> >refresh what is displayed in the user's browser?
> >
> >I hope the question makes sense.
> >
> >thanks!
> >-jeff
> >
> >__________________________________________________
> >Do you Yahoo!?
> >Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> >http://mailplus.yahoo.com
> >
> >--
> >To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> >For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
> 
> 
> ____________________________________
> Justin Ruthenbeck
> Software Engineer, NextEngine Inc.
> justinr@nextengine.com
> Confidential -
>     See http://www.nextengine.com/confidentiality.php
> ____________________________________
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message