You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rajesh P <ra...@mphasis.com> on 2002/07/29 16:16:29 UTC

Need a Design pattern suggestion

Hi,
Have a small problem on deciding the approach. 
We have a datasource which is a C++ server that returns data in the form
of a byte array ranging from 8000 to 32000 bytes of data. There would be
many chunks of such byte arrays.
FYI, we are using the Struts framework.

Requirement:
1) To be able to parse this byte array according to a predefined format
and display it in the JSP in the form of a table.
2) To be able to sort on the displayed columns of the table.
3) The transaction involves navigation across multiple screens. 
For ex, 
a) in the first screen I would be displaying the Customer Number and
Name along with a list of Orders in the form of a table.
b) Clicking on one of the orders takes to the second screen
c) In the second screen, it is required to display the Customer number,
name, selected order details as header and a list of line items
associated with the order (in the table format).
So now when we navigate to the second screen, the Customer number, name
and selected order details should be got from the byte array fetched and
only the line items should be taken from the C++ datasource. So there
should be a mechanism to retrieve any data from the byte array based on
a key value.

We have thought of the following approaches.
1) Create objects which would hold each record of the byte array. In
such a case, the disadvantage would be the number of objects which are
created that would hit the performance. Advantage would be that a
collection sort on the object would simplify the sorting process.
2) Have the byte array as it is and parse on it each time it is
required. In this case, a sorting of the records would be dicey.

Can you kindly suggest a mechanism which would be best suited to satisfy
the performance as well.

Thanks in advance,
Regards
Rajesh


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>