Title: Message
Hi Ranjith,
 
You have already vaidated the data entered in JSP page using your form bean. Why do you want to validate the data once again before submitting to the session bean?.
 
Regards,
TPS
-----Original Message-----
From: Kilari Ranjith Kumar [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 12:28 PM
To: [EMAIL PROTECTED]
Subject: Separation of Validation logic from Session Beans

Hi All,

 

 At present the validation of data is being handled in the following way.

User enters data in a jsp which is first validated by the form bean(struts is being used) before submitting to the Session Bean which validates the data again before calling the DAO classes, this is done to support non-web clients also.  Now we have the same validation logic in two places, which obviously is not a good design, and the presence of this in the session bean clutters up the code and makes it very difficult to maintain.

 

 One solution is to have a common utility class for both the form bean and the session bean which will contain all the validation logic.  But still the session bean will have calls to the util class in its code, I do not want this. I want to make session beans totally independent of validation, they just need to get the data and concentrate on the data transformation and data retrieval operations.

One way I can think of is to have a fa�ade like component intercepting calls from the client and validating the code before passing it on to the concerned session bean.

 

I don't know how good or a bad design is this, there must surely be better solutions to this problem. It would be great if you guys can share your ideas reg this.

 

Ranjith

Reply via email to