tags:

views:

376

answers:

2

I had experience with struts, and briefly experimented with tiles. I know that within a layout each tile is a separate jsp page. Suppose I hit a button on each of four tiles, and each tile was (indirectly) calling a different web service. Would the tiles refresh asynchronously as results came in at different times?

+1  A: 

I think it would depend on the code in the background. You say that the tiles were indirectly calling web services. I would think it would refresh asynchronously unless you specified in your code for it not to do so. Say you push button 1 and then button 2. Action 1 comes back and your code says that the screen needs to be updated and the page will refresh. Once action 2 gets back, your code would again update the screen. I believe this is how it works, but having never tried it, I can't be sure.

Why not just throw together a two tiled test page with buttons and try it out. That should give you a definitive answer.

BoboTheCodeMonkey
+2  A: 

Tiles are just fragments of one html page. There's no notion of ajax unless you manually add it. Therefor: Pressing 4 buttons on one page would be the same as clicking 4 links on any html page. The browser will send the appropriate request to the server. When the server answers very quickly, you wouldn't even have time to press the second button. When it's slow enough, the first request (browser to server) would be cancelled and the second (third, fourth) would be sent (and cancelled with the next button pressed).

The rest depends upon the backend implementation: At some point in time the server will notice that it cannot send back data for 3 of the 4 requests. What will be served/displayed in the last (open) response also depends upon your implementation. If there's some server side state holding the web services response, all 4 results might show up. If one web service hasn't returned yet, only 3 results and one old tile might show up.

Olaf