Dear all,I did post this on the sun forum with out too much help. I am assumingI shall be lucky enough to get some here.Since I am clueless on how I wish to do it, I do not really haveanything that I have done.This is part of my problemWhat I am doing is : Displaying the value (price of an item) from thedatabase on to a JSP.The price of the item can be changed. I am putting that in a cache(because only the final updated price goes to the db) and then; what Ineed to do it : to display this updated price (from the cache) in allbrowsers that are currently "seeing" this JSP, without having torefresh the jsp, i.e.I have dabbled with ajax, however I am stuck at : the Jsp can make anasync. call to the servlet, but how do I make the servlet send thechanged value to the jsp.to put across my point in a more clearer way.There is a timer running.You can think Its like an auction site which multiple people wouldaccess. they could change values (prices, amounts they would enter asa bid). If a user A enters an amount then that should be displayed toother users logged in too. Users B,C and D should be able to see thechanged amount, which means B,C and D('s browsers) should beautomatically updated. They wouldnt be making any requests to theserver.What ways could I explore to achieve this behaviour ?I would appreciate if some one could point me to a direction.Rgds,
|
|
0
|
|
|
|
Reply
|
Buddha
|
1/30/2008 6:32:20 AM |
|
On Jan 30, 6:32 am, Buddha <happybudd...@gmail.com> wrote:
> Dear all,
>
> I did post this on the sun forum with out too much help. I am assuming
> I shall be lucky enough to get some here.
> Since I am clueless on how I wish to do it, I do not really have
> anything that I have done.
> This is part of my problem
>
> What I am doing is : Displaying the value (price of an item) from the
> database on to a JSP.
> The price of the item can be changed. I am putting that in a cache
> (because only the final updated price goes to the db) and then; what I
> need to do it : to display this updated price (from the cache) in all
> browsers that are currently "seeing" this JSP, without having to
> refresh the jsp, i.e.
>
> I have dabbled with ajax, however I am stuck at : the Jsp can make an
> async. call to the servlet, but how do I make the servlet send the
> changed value to the jsp.
>
> to put across my point in a more clearer way.
> There is a timer running.
> You can think Its like an auction site which multiple people would
> access. they could change values (prices, amounts they would enter as
> a bid). If a user A enters an amount then that should be displayed to
> other users logged in too. Users B,C and D should be able to see the
> changed amount, which means B,C and D('s browsers) should be
> automatically updated.
> They wouldnt be making any requests to the server.
With standard HTTP - NO WAY, the server can not push anything to the
client without a request.
You can embed <applet> (or similar) in your page, and then this applet
will maintain connection with the server - this is NOT a good practice
though -> if you have a lot of clients (imaging everybody in your city
trying to login at once) you will run out of connections on your
server(s).
So you will have to make periodic requests to the server (via AJAX is
one of the options) for updates from each client.
> What ways could I explore to achieve this behaviour ?
>
> I would appreciate if some one could point me to a direction.
>
> Rgds,
|
|
0
|
|
|
|
Reply
|
garlington (99)
|
1/30/2008 12:10:39 PM
|
|
> There is a timer running.I'm not sure if you have tried this but;Why not create a javascript timer, one that sends a request to aservlet every few seconds/minutes (depending on your capacity/serverload). In this way the response could give the value of the field youneed.Ive done something similar in the past, but at a previous company so ican't copy paste code im afraid. I managed it with the references atw3schools. Great site that.Hope that helps,Graeme
|
|
0
|
|
|
|
Reply
|
gwoodhouse
|
1/30/2008 3:34:08 PM
|
|
On Jan 30, 8:34=A0pm, "gwoodho...@gmail.com" <gwoodho...@gmail.com>
wrote:
> > There is a timer running.
>
> I'm not sure if you have tried this but;
>
> Why not create a javascript timer, one that sends a request to a
> servlet every few seconds/minutes (depending on your capacity/server
> load). In this way the response could give the value of the field you
> need.
>
> Ive done something similar in the past, but at a previous company so i
> can't copy paste code im afraid. I managed it with the references at
> w3schools. Great site that.
>
> Hope that helps,
>
> Graeme
Hi,
thanks for your replies.
>make periodic requests to the server (via AJAX is
Well, thats the point. Assume 5 browsers have established a session
with the web server.
now 1 of them has bid his amount, whcih is, changed the current price
value. THIS, can be posted to the server.Also can be done using AJAX.
However, I would also want to update the rest of the 4 browsers with
the latest update of the price.
> Why not create a javascript timer, one that sends a request to a
> servlet every few seconds/minutes (depending on your capacity/server
> load). In this way the response could give the value of the field you
> need.
The seconds part is what I also thought about; because this is a
auction site and all users got to be updated asap. However, I am
afraid, I dont know if it is a good solution.
Wont it increase the traffic, slow down the performance and restrict
the number of users I can have ?
I have heard a lot of stock tickers work the same way. Any clue on how
they function ?
thanks
|
|
0
|
|
|
|
Reply
|
happybuddha1 (5)
|
1/31/2008 5:12:40 AM
|
|
Buddha wrote:
> On Jan 30, 8:34 pm, "gwoodho...@gmail.com" <gwoodho...@gmail.com>
> wrote:
>>> There is a timer running.
>> I'm not sure if you have tried this but;
>>
>> Why not create a javascript timer, one that sends a request to a
>> servlet every few seconds/minutes (depending on your capacity/server
>> load). In this way the response could give the value of the field you
>> need.
>>
>> Ive done something similar in the past, but at a previous company so i
>> can't copy paste code im afraid. I managed it with the references at
>> w3schools. Great site that.
>>
>> Hope that helps,
>>
>> Graeme
>
>
> Hi,
>
> thanks for your replies.
>> make periodic requests to the server (via AJAX is
> Well, thats the point. Assume 5 browsers have established a session
> with the web server.
> now 1 of them has bid his amount, whcih is, changed the current price
> value. THIS, can be posted to the server.Also can be done using AJAX.
> However, I would also want to update the rest of the 4 browsers with
> the latest update of the price.
Right. Did you have a question there? Why wouldn't Graeme's suggestion work
for you?
The basic pattern for a resource manager (your server manages the resource of
common knowledge) is to have it answer only, and let the resource consumers be
request only.
The resource manager "holds" the request until it has an answer. So on the
"status" channel all /n/ clients request session status, but do not get an
answer right away. When one of the clients makes a change (a new bid), it
pushes the change on the "change" channel. The server then answers all /n/
requests for status with the new data over their respective "status" request
channels. When the clients receive their status data, they immediately make a
new request for the next status over their respective "status" channels.
Continue until shampoo bottle is empty.
--
Lew
public void washHair( ShampooBottle bottle ) throws EmptyBottleException
{
do { wash(); rinse(); } while ( repeat );
}
|
|
0
|
|
|
|
Reply
|
lew (2143)
|
1/31/2008 2:50:19 PM
|
|
On Jan 30, 9:12 pm, Buddha <happybudd...@gmail.com> wrote:
> On Jan 30, 8:34 pm, "gwoodho...@gmail.com" <gwoodho...@gmail.com>
> wrote:
>
>
>
> > > There is a timer running.
>
> > I'm not sure if you have tried this but;
>
> > Why not create a javascript timer, one that sends a request to a
> > servlet every few seconds/minutes (depending on your capacity/server
> > load). In this way the response could give the value of the field you
> > need.
>
> > Ive done something similar in the past, but at a previous company so i
> > can't copy paste code im afraid. I managed it with the references at
> > w3schools. Great site that.
>
> > Hope that helps,
>
> > Graeme
>
> Hi,
>
> thanks for your replies.>make periodic requests to the server (via AJAX is
>
> Well, thats the point. Assume 5 browsers have established a session
> with the web server.
> now 1 of them has bid his amount, whcih is, changed the current price
> value. THIS, can be posted to the server.Also can be done using AJAX.
> However, I would also want to update the rest of the 4 browsers with
> the latest update of the price.
>
> > Why not create a javascript timer, one that sends a request to a
> > servlet every few seconds/minutes (depending on your capacity/server
> > load). In this way the response could give the value of the field you
> > need.
>
> The seconds part is what I also thought about; because this is a
> auction site and all users got to be updated asap. However, I am
> afraid, I dont know if it is a good solution.
> Wont it increase the traffic, slow down the performance and restrict
> the number of users I can have ?
> I have heard a lot of stock tickers work the same way. Any clue on how
> they function ?
>
> thanks
Also look into cometd.
It is an AJAX like technology that lets you "push" values to the
clients.
In practice though, you should make every attempt to inform the
customer that the value has changed, but don't assume that they were
informed before they made an action (the value could have changed
between the time they pressed the mouse button and the browser
registered it).
|
|
0
|
|
|
|
Reply
|
googlegroupie (586)
|
2/1/2008 1:52:30 AM
|
|
> Also look into cometd.> It is an AJAX like technology that lets you "push" values to the> clients.>Thanks. am gonna take a look at it now.>Right. Did you have a question there? Why wouldn't Graeme's suggestion workfor youI did :> slow down the performance and restrict>the number of users I can have ?>I have heard a lot of stock tickers work the same way. Any clue on how>they function ?I guess am gonna go with Graeme's solution.> > > Graeme@ Graeme : Thanks. I am gonna follow this thing. Just that, I willhave to change the refresh rate too as the timer ticks towards zero,the refresh rate gets higher.thanks again.Rgds
|
|
0
|
|
|
|
Reply
|
Buddha
|
2/1/2008 8:52:09 AM
|
|
|
6 Replies
129 Views
(page loaded in 0.114 seconds)
Similiar Articles: VBOs vs Display Lists - lets test it out! - comp.graphics.api ...Display-lists yet again, have the ability to change opengl-state, and apply matrices ... Uint32 col=0; // Temporary pixel value ... the card has a 10-entry vertex-cache ... How can you get an incomplete ARP? - comp.dcom.sys.cisco ...... if a reply is received, it then updates the record in the arp cache ... > e.g change the first octet. Maybe you did ... The initial time-to-live value for the ARP cache can be ... gdb (linux) "print" command clears memory corruption - so how do I ...... memcpy(new_entry, &newloc, IRECPTRLEN); I display these values ... You have a Schr dinger bug, i.e. one that changes ... It could be related to the cpu cache (e.g. the new ... Auto numbering related records - comp.databases.filemaker ...... an ran into a little problem with auto-entered values. ... number) and a second table "items" which is display in a ... More importantly, a change in 8 from previous versions ... Fastest way to draw lots of triangles -- redux (FYI) - comp ...Folks, After our flurry of Display List/VBO ... there was talk about keeping VBO's under the T&L cache ... my position is mistaken,' and then they actually change ... lp commands take a while to execute - comp.unix.solarisNo changes were made on the print client except - a ... Sep_07 svc:/application/print/ppd-cache- update:default ... Lee On Mon, 7 Nov ... return ... values that you enter ... Memory problem - comp.lang.asm.x86But if I change n to 8000, it takes only 0.6 seconds! ... REP MOVS on both Intel and AMD cpu's: failure to update ... with it is dividing N by 12, if N is a runtime value. Fast bit-reverse on an x86? - comp.dspShow them that you are the DSP engineer, not some code ... MOV, you'd still need to access 32-bit or 64-bit value ... doesn't have to wait for bits 31:8 of eax to be updated ... Odd BACKUP error: unsupported file structure ! - comp.os.vms ...... but has BACKUP /IMAGE kept up to date with the changes to ... was also slow as hell, MONITOR would consistently show ... An update: I booted minimum, and backup/image was just ... Could anyone give me the spice-mode.el - comp.emacsHi, All I am new to *NIX and I am thinking of writing spice code under Emacs. However, I have no idea of Emacs Lisp. Hence, I could not write a packa... Using Custom WebLogic JSP Tags (cache, process, repeat)... WebLogic JSP Tags (cache ... used does not change the size of that cache ... and display it, only update it every minute--> </wl:cache> <!--incoming parameter value isbn is the ... Using Custom WebLogic JSP Tags (cache, process, repeat) - 11g ...... WebLogic JSP Tags (cache ... used does not change the size of that cache ... ticker and display it, only update it every minute--> </wl:cache> <!--incoming parameter value ... 7/16/2012 10:28:10 AM
|