本文整理汇总了Java中net.sourceforge.stripes.validation.ValidationErrors.addGlobalError方法的典型用法代码示例。如果您正苦于以下问题:Java ValidationErrors.addGlobalError方法的具体用法?Java ValidationErrors.addGlobalError怎么用?Java ValidationErrors.addGlobalError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.stripes.validation.ValidationErrors
的用法示例。
在下文中一共展示了ValidationErrors.addGlobalError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleValidationErrors
import net.sourceforge.stripes.validation.ValidationErrors; //导入方法依赖的package包/类
/**
* ValidationErrorHandler
*/
public Resolution handleValidationErrors(ValidationErrors errors) {
if (errors.hasFieldErrors()) {
errors.addGlobalError(new SimpleError("Check fields.\n"));
}
return null;
}
示例2: validateProductListIsEmpty
import net.sourceforge.stripes.validation.ValidationErrors; //导入方法依赖的package包/类
@ValidationMethod(on = "delete")
public void validateProductListIsEmpty(ValidationErrors errors) {
try {
pcPersist.init(getDataBaseConnection());
setCategory(pcPersist.read(getCategory().getId()));
if (!getCategory().getProductCollection().isEmpty()) {
errors.addGlobalError(new SimpleError(
getLocalizationKey("error.ProductCategory.IncludeProducts"), getCategory().getName(), getCategory().getProductCollection().size()
));
}
} catch (SQLException ex) {
getContext().getValidationErrors().addGlobalError(
new SimpleError(ex.getMessage()));
}
}
示例3: customValidationError
import net.sourceforge.stripes.validation.ValidationErrors; //导入方法依赖的package包/类
/**
* An error is saved during custom validation if first > 100.
*/
@ValidationMethod(on={"oneRefreshAdd", "oneRefreshAjaxUpdater"})
public void customValidationError(ValidationErrors errors) throws InterruptedException {
if (this.first > 100) {
errors.addGlobalError(new SimpleError("Event could not complete normally."));
}
}
示例4: addError
import net.sourceforge.stripes.validation.ValidationErrors; //导入方法依赖的package包/类
public ValidationError addError(String f, SimpleError e, ValidationErrors v) {
errors.add(e);
if (v!=null)
if (f!=null)
if (f.length()>0)
v.add(f, e);
else
v.addGlobalError(e);
else
v.addGlobalError(e);
return e;
}
示例5: validateHeadCall
import net.sourceforge.stripes.validation.ValidationErrors; //导入方法依赖的package包/类
@ValidationMethod( on = "head" )
public void validateHeadCall( ValidationErrors errors )
{
errors.addGlobalError( new SimpleError( "The head request was not valid for whatever custom reason." ) );
}
示例6: addValidationError
import net.sourceforge.stripes.validation.ValidationErrors; //导入方法依赖的package包/类
protected void addValidationError(String message, Object... parameter) {
ValidationErrors validationErrors = getContext().getValidationErrors();
validationErrors.addGlobalError(new SimpleError(message, parameter));
}