Hi Vladas,
you have a few options here.
1. If youre using a business delegate you can incorporate validation within that tier.
2. Use
servlet filters as decorators to validate your data before it leaves the web tier.
3. Validate in EJB tier with session beans. This can cause unnecessary overhead if your EJB tier is remote.
4. Use
Struts. It has good inherent data validation support.
5. Place validation code within the value objects.
6. Validate in Entity EJB. This is not recommended, as Enity EJB should not be used for business logic. And your value object may not map directly to the EJB.
Personally I would go for a design with clean separation of responsibilities, and use validation helper classes in the web tier, which is closer to where you are presenting and modyfying the data objects. For simple flow of logic, use a servlet filter to validate your javabeans before calling BD or EJB's. For more complex requirements go with Struts, it is a higher learning curve but is powerful.
Whichever you choose, your validator helper classes should be portable enough to be called from any tier within your app. The patterns
you should consider for implementing validation helpers are Factory and Strategy.