You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chetan Pandey <cp...@bluesingapore.com> on 2006/12/11 04:23:12 UTC

html:link

Hi All:

 

I have a <html:link> in the Title of a Table.

 

Clicking on it should arrange all Rows in ascending Order the first time and
descending order the next time and so on.

 

I tried the following:

 

<%

int sortOrder=0;

//<bean:definfe failed miserably

%>

 

<html:link action="myAction.do?function=sort?sortOrder='${sortOrder++}' "

Event Name

</html:link>

 

In which (sortOrder % 2 == 0) will determine how to modify the table.

 

This however failed as we are not allowed to use post-increment operator.

 

Can anyone recommend a better approach.

 

Thanks.

 

Chetan

 

 

 

 


RE: html:link

Posted by "Strachan, Paul" <Pa...@det.nsw.edu.au>.
a) The displayTag library can sort for you
b) you can only pass one parameter using html:link (unless you use a Map)
c) if "function" is a Dispatch method you could use javascript onclick event handler to submit to the "sort" method, passing the sortOrder parameter - then toggle it in your action and put the new value back on the request for next use.

________________________________

From: Chetan Pandey [mailto:cpandey@bluesingapore.com]
Sent: Mon 11/12/2006 2:23 PM
To: 'Struts Users Mailing List'
Subject: html:link



Hi All:



I have a <html:link> in the Title of a Table.



Clicking on it should arrange all Rows in ascending Order the first time and
descending order the next time and so on.



I tried the following:



<%

int sortOrder=0;

//<bean:definfe failed miserably

%>



<html:link action="myAction.do?function=sort?sortOrder='${sortOrder++}' "

Event Name

</html:link>



In which (sortOrder % 2 == 0) will determine how to modify the table.



This however failed as we are not allowed to use post-increment operator.



Can anyone recommend a better approach.



Thanks.



Chetan











**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org