0

How to creaet custom constraint to check date.

asked 2012-03-20 03:29:36 +0800

dearest555 gravatar image dearest555
111

Constraint wrkdate = new Constraint() {
public void validate(Component comp, Object value) throws WrongValueException {
System.out.println("working date value"+wrkdate);
if (value == null || value.toString().trim().equals(""))
{
throw new WrongValueException(comp, "Please input before 2 working date");
}
GeneralDAO generalDAO = SpringUtil.getBean("generalDAO");
if (generalDAO.find(Stock.class, value.toString()) == null){
throw new WrongValueException(comp, "This stock number does not exist");
}
}
};

delete flag offensive retag edit
Be the first one to reply this discussion!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-03-20 03:29:36 +0800

Seen: 84 times

Last updated: Mar 20 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More