jexl

时间:2017-06-27 19:08:54

标签: jexl

我一直在努力想出一个自定义验证,它将检查下面的所有三种情况,并根据满足的条件返回错误消息。这些验证单独工作,有人可以提供有关如何使系统继续进行验证2然后3并显示所有消息的帮助,无论先前的条件是否满足

{//VALIDATION1

{ if (this.LastDate < this.occurrence_date) 
{ return "Last Date of Occurrence must be after First Date of Occurrence"; } 

}
}
{//VALIDATION2

{ if (this.FinancialProvision > sysdate) 
{ return "Financial provision date cannot be a future date"; } 

}
}

{//VALIDATION3

{ if (this.Settlement > sysdate) 
{ return "Settlement date cannot be a future date";} 

}
}

1 个答案:

答案 0 :(得分:0)

为什么不连接验证字符串?然后最后返回连接字符串。

validation ="";

{//VALIDATION1

{ if (this.LastDate < this.occurrence_date) 
{ validation += " Last Date of Occurrence must be after First Date of Occurrence"; } 

}
}
{//VALIDATION2

{ if (this.FinancialProvision > sysdate) 
{ validation += " Financial provision date cannot be a future date"; } 

}
}

{//VALIDATION3

{ if (this.Settlement > sysdate) 
{ validation += " Settlement date cannot be a future date";} 

}
}
return validation;