Tiles Framework - Refresh a single Tile

Discussions

Web tier: servlets, JSP, Web frameworks: Tiles Framework - Refresh a single Tile

  1. Tiles Framework - Refresh a single Tile (5 messages)

    Hi All,

    I need advice from you regarding the following issue with Tiles Framework implementation.

    In our implementation, we have a Tiles layout which will have Header, Menu, Body and Footer tiles. In this layout whenever user does some action in the Body tile and want to refresh the page, the whole Layout (Incl Header, menu and footer) will be refreshed.

    This will be a hit on performance as there will not be any change in the Header, menu and Footer sections of the application but still very expensive server calls will be made.

    Is there any way to prevent the refresh of the Header, menu and Footer and refresh only the Body content which can be implemented using Tiles ?

    Thanks in advance,

    regards,
    Bharath
  2. If you want refresh only one tile use html frames or you could look for more complex way - Ajax http://www.javalobby.org/articles/ajax/

    --
    Alex Magdenko
  3. It's conceptually not possible, since a tile-based page is just ONE page; being so, the browser queries the hole page. The only performance improvement would be not to recompile the header and footer JSPs.

    Cheers and happy coding,
    Martin
  4. It is true that you can't just refresh one tile.

    There are options to just refresh parts of the page though.

    You could use frames and direct targets at specific frames to reload. But that kind of defeats the purpose of using tiles in the first place.

    You could use AJAX to refresh portions of the body content, but its more complex and you're again not basing page construction on Tiles.

    If the header, menu and footer are so expensive to calculate maybe you should consider putting some of the calculated data into the session or some other type of cache. Its been my experience though, that most header data is lightweight, the menu data doesn't require much processing and the footers are usually static. Don't try to over optimize, especially not early in the development process.
  5. Don't try to over optimize, especially not early in the development process.

    AKA "Don't fix it if it aint broken" ;)
  6. AKA "Don't fix it if it aint broken" ;)

    Not really though. I think refactoring of working code can be a very useful process.