Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 29066 invoked from network); 25 May 2004 06:09:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 May 2004 06:09:17 -0000 Received: (qmail 6000 invoked by uid 500); 25 May 2004 06:09:18 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 5925 invoked by uid 500); 25 May 2004 06:09:17 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 5890 invoked by uid 98); 25 May 2004 06:09:17 -0000 Received: from kprasad@capitalservicing.co.jp by hermes.apache.org by uid 82 with qmail-scanner-1.20 (clamuko: 0.70. Clear:RC:0(203.112.27.99):. Processed in 0.059952 secs); 25 May 2004 06:09:17 -0000 X-Qmail-Scanner-Mail-From: kprasad@capitalservicing.co.jp via hermes.apache.org X-Qmail-Scanner: 1.20 (Clear:RC:0(203.112.27.99):. Processed in 0.059952 secs) Received: from unknown (HELO capital-mx.capitalservicing.co.jp) (203.112.27.99) by hermes.apache.org with SMTP; 25 May 2004 06:09:17 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Design Issue - Unchanged data getting submitted Date: Tue, 25 May 2004 15:09:39 +0900 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Design Issue - Unchanged data getting submitted Thread-Index: AcRCHmdvjjk0z77rQsuMJCFCpqYDhAAAFRxg From: "Prasad, Kamakshya" To: "Struts Users Mailing List" X-Spam-Rating: hermes.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, We had a similar kind of issues in our last project and we thought about = a methodology also.=20 Please let me know if there are any issue with this or somewhere it = needs correction or is a performance bottle neck etc etc. =20 I will explain it with an example. We had a screen called Asset Details = having following sections Asset Overview (Textboxes and Drop downs + 1 Textarea comment box) Asset Comparative Statistics(Textboxes and Drop downs + 1 Textarea = comment box) Asset Highlights (2 Textarea comment box) Asset Pricing (Textboxes and Drop down) Instead of making a single VO we made 4 VOs for each of the sections. = Every VO has a method called isDirty() and dirtyLog(). The dirtyLog() = method used to take the object of the same class as parameter and in the = method compares the fields with its own internal fields. The changed = fields where put into a concatenated string. The reason for dong so was = that the client wanted to have the log for whatever changes happened in = the screen against the user id that has done this change. =20 So method looked something like this=20 =20 Public class AssetOverviewVO() { public String dirtyLog(AssetOverviewVO assetOverviewVO) { if = (!this.strAssetManager.equals(assetOverviewVO.getAssetManager()) { dirty =3D true; strChangedLog.append(" Asset Manager " ) strChangedLog.append(" Old Value : " ) strChangedLog.append(assetOverviewVO.getAssetManager()) strChangedLog.append(" New Value : " ) strChangedLog.append(this.strAssetManager) } =20 //Similarly we did it for all the fields. We wrote a utility excel = macro to do the value object generation. } } In DAO we used to check that if that section is dirty then we save it = else leave it. Only problem was with the comments fields as the string = comparison for them might have created a performance issue. For them we kept hidden variables in the form itself. Whenever there is = a change we marked it as true. In the ActionClass we set the isDirty() = method to true if there is any change in the comments. One issue with this design is that the last generated set of VOs has to = be kept in the session. We had a method in a baseaction class to flush = out the VOs of last requests and put the VOs of latest requests in the = session if there are no exceptions. Again this method can be called from = each of the action mehod where u are setting the form from the VO. Please let me know if it suites your requirement KP -----Original Message----- From: Milind Kulkarni [mailto:mikulkar@cisco.com]=20 Sent: Tuesday, May 25, 2004 3:09 PM To: 'Struts Users Mailing List' Cc: 'Dhanesh Vasandani' Subject: RE: Design Issue - Unchanged data getting submitted Hi, Update record problem: I assume that you have a Header record and multiple child records for = this header. To ensure that only the changed records are saved you will have = to mark them as "Changed" from the UI. And pass only the changed ones to Business Layer so that only changed ones are saved. Since you are saying that you have a complex form and multiple fields then it would be even = more trickier. You can probably manage this problem using versioning. When you are = updating the record. Mark the existing records as inactive. Increment the counter (version) and insert the new set of records. No doubt, you will end up = with multiple versions of records but then if you have any audit requirements that will be satisfied using this approach. Thanks, Milind -----Original Message----- From: Viral_Thakkar [mailto:Viral_Thakkar@infosys.com] Sent: Monday, May 24, 2004 7:42 PM To: Struts Users Mailing List Cc: Dhanesh Vasandani Subject: Design Issue - Unchanged data getting submitted Dear all, We have a application built using Struts. Below is the architecture in brief : JSP =E0 Action Class =E0 Business Delegate =E0 Session Fa=E7ade =E0 = Database We are not using Action forms. We are using Value Objects (VO) to pass data between web tier and App tier (from action to EJB via Business Delegate). Problem: We have a very big form with many input fields/select fields. There are two scenarios 1.. Insert the record This seems fine. We take all the data entered by user on the screen = in action class, create VO and pass it to EJB which inserts into database. 2.. Update the record Here we have a Problem. Screen is populated with data retrieved from database. Here user can update few/all fields. All the fields are under one form. User clicks on save button. Only one Save button is available on page which submits the complete page. The problem is that even if user does not update/add any value and clicks on save button, all the field values (unchanged and changed, both) will pass till EJB and the whole record in database will = get updated but in reality update require only for changed fields. Screen is bit complex with all types of input fields with ADD MORE = and DELETE ROWS kind of functionality also. Screen can not have more than = one SAVE button. Please let us know what to use to solve such kind of performance = issues. Thanks & Regards, Viral --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org