Friday, December 01, 2006

Using Displaytag with tiles

If you run the example in the previous post, with each click on the related table you will see that the URL has changed to reflect that of the JSP
This may cause problems when using Struts with tiles. In order to avoid the problem you have to change add a new attribute to the display:* tag
In the JSP file in step 2 of "Struts: Paging and Sorting with Displaytag", change the display:table tag, change the tag to look as shown below:
<display:table name="sessionScope.empList" pagesize="4" id="empTable" sort="external" defaultsort="1" defaultorder="ascending" requestURI="">
Now, the URL appears as shown below
This solution in mentioned in the displaytag FAQ page(Had to dig a little to find it :) ). Once you have done this, you can safely use it with tiles too.


  1. Abhi,

    Is there a way in display tag to sort on multiple columns.

    Meaning when the list comes back I want it sorted like a
    order by col1, col3, col2 etc.,

    the defaultsort just does it for one



  2. Can I use Javascript in requestURI attribute in displaytag?


Popular Posts