Hello

Do you need this sequence to be full JSP ?? Because JavaScript librairies exist to let you directly sort tables. Thus, no page reload is needed.

Thomas

At 11:39 15/01/2003 +0000, you wrote:

> -----Original Message-----
> From: Jason Yam [mailto:[EMAIL PROTECTED]]
> Sent: 15 January 2003 06:52

--////--

>
>
> Hi all,
>
>     anyone knows how to implement this sequence of operations
> in struts
> (i.e. click column header to sort)?
>
>     DisplayAction -> jsp form -> ProcessAction -> jsp result
> with header for
> sorting -> click one header -> jsp result with header for
> different sorting
> order
>
>     The result jsp has a table with multiple column headers.
> A user can
> click one of the column headers to sort the data in different
> order.  I do
> not know how to implement this in struts .  Do I need to make
> a form in the
> result jsp so that I can make another ProcessAction for sorting.  For
> instance,
>
>     DisplayAction -> jsp form -> ProcessAction *A* -> jsp
> result with header
> for sorting -> click one header -> ProcessAction *B* -> jsp
> result with
> header for different sorting order
>
>     How to change the struts-config to make it work?

I did it totally differentlty. I had a report generate action and
generic form `ViewReport' and `ViewReportForm' respectively.
The business report action form was stored in the SESSION scope.
This generated a report. My action form stored a list of rows as
a Java collection in a nested attribue "rows".

I rendered the report using HTML Tables in a bog standard JSP.
For each column I designed two up and down arrow gifs and generated
two html link using the gifs

I wrote a new action `SortReport' and form `SortReportForm' with
two attributes "column" and "order" (ascending and descending).
The sort action just sorted the existing rows retrieved
from the `ViewReportForm' (action form in the session) and forward
dispatches back to the report jsp.

Of course I realised, back then, that I could move the actual
sorting in to the `SortReport' in to `ViewReport' action, but
I had a brainstorm, I could write the SortReport to sort any
sort of data stored in rows. However I never got around
to figuring out the code to do it. It involved a lot of `String'
to actual Java Object instantiation ie reflection. Ah well.

--
Peter Pilgrim,
Struts/J2EE Consultant, RBoS FM, Risk IT
Tel: +44 (0)207-375-5642


********************************************************************
      Visit our Internet site at http://www.rbsmarkets.com

This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
The Royal Bank of Scotland plc is registered in Scotland No 90312
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB
Regulated by the Financial Services Authority
********************************************************************

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to