Have an object Custs

which is having attribute modDate of type Date.

In prepare action.

DateFormat dateFormat = new SimpleDateFormat("MM/dd/yy");

Custs cust1 = new Custs();
cust1.setModDate=dateFormat.parse("7/1/05");

Custs cust2 = new Custs();
cust2.setModDate(dateFormat.parse("10/10/05"));

Custs cust3 = new Custs();
cust3.setModDate(dateFormat.parse("6/10/04"));

Custs cust4 = new Custs();
cust4.setModDate(dateFormat.parse("1/10/05"));

Custs cust5 = new Custs();
cust5.setModDate(dateFormat.parse("10/10/05"));

Custs cust6 = new Custs();
cust6.setModDate(dateFormat.parse("07/1/05"));

Custs cust7 = new Custs();
cust7.setModDate(dateFormat.parse("10/10/05"));

Custs cust8 = new Custs();
cust8.setModDate(dateFormat.parse("6/10/04"));

Custs cust9 = new Custs();
cust9.setModDate(dateFormat.parse("1/10/05"));

Custs cust10 = new Custs();
cust10.setModDate(dateFormat.parse("10/10/05"));

above are the date values
created a list with the above Custs obj and set that value to the form 
attribute.


In jsp
<display:table name="sessionScope.Form.custs" id="custObj" 
requestURI="PrepareAction.do" defaultsort="8" defaultorder="descending" 
pagesize="6">
....................
..................
<!-- Modified Date -->
  <display:column sortable="true" titleKey="lbl.modifieddate">
         <c:if test="${custObj.modifiedDate != null}" >
               <fmt:formatDate value="${custObj.modifiedDate}" 
pattern="MM-dd-yyyy" var="lastModDate"/>
                        <c:out value="${lastModDate}"/>
          </c:if>
  </display:column>

</display:table>


the sorted values got is
10-10-2005
10-10-2005
10-10-2005
10-10-2005
07-01-2005
07-01-2005
06-10-2004
06-10-2004
01-10-2005
01-10-2005

not sure why the 2004 values are in the middle. Not sure why the sort isn't 
working. Not sure what mistake I did.

Also, what happens when the user deletes couple of rows and then restores 
them back. I am adding them to the original list. does it get sorted too???

Thanks.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to