struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anjib Mulepati <anji...@hotmail.com>
Subject use of validate() method [S 1.3.8]
Date Wed, 14 Dec 2011 20:21:28 GMT
Hi All,

I have question regarding use of validate() method in Struts 1.3.8.

I have simple form to collect couple of information (e.g. code and name) 
and have to add them to the Database. All database operations are 
handled by my DAO layer.

Both code and name are unique in Database. So I want to validate code 
and name before calling INSERT SQL statement.

Three methods I have in DAO layer are
      - Cutomer findByCode(String code);
      - Customer findByName (String name);
      - void createCustomer (Cutomer cust);

So I am calling first two methods in validate() method and third one in 
execute() method.

Is this a good way to do validation before inserting the record? Or 
there is better logic/design than this?

I will be glad if anyone can answer my curiosity.

Thanks,
Anjib




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


Mime
View raw message