本文整理汇总了Java中com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator类的典型用法代码示例。如果您正苦于以下问题:Java RequiredFieldValidator类的具体用法?Java RequiredFieldValidator怎么用?Java RequiredFieldValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequiredFieldValidator类属于com.opensymphony.xwork2.validator.annotations包,在下文中一共展示了RequiredFieldValidator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@Validations(
requiredStrings = {
@RequiredStringValidator(fieldName = "role.name", message = "角色名称不允许为空!")
},
requiredFields = {
@RequiredFieldValidator(fieldName = "role.authorityList", message = "角色权限不允许为空!")
}
)
@InputConfig(resultName = "error")
public String save() throws Exception {
List<String> authorityList = role.getAuthorityList();
authorityList.add(Role.ROLE_BASE);
role.setAuthorityList(authorityList);
roleService.save(role);
redirectUrl = "role!list.action";
return SUCCESS;
}
示例2: update
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@Validations(
requiredStrings = {
@RequiredStringValidator(fieldName = "role.name", message = "角色名称不允许为空!")
},
requiredFields = {
@RequiredFieldValidator(fieldName = "role.authorityList", message = "角色权限不允许为空!")
}
)
@InputConfig(resultName = "error")
public String update() throws Exception {
Role persistent = roleService.load(id);
List<String> authorityList = role.getAuthorityList();
authorityList.add(Role.ROLE_BASE);
role.setAuthorityList(authorityList);
if (persistent.getIsSystem()) {
addActionError("系统内置角色不允许修改!");
return ERROR;
}
BeanUtils.copyProperties(role, persistent, new String[] {"id", "createDate", "modifyDate", "isSystem", "adminSet"});
roleService.update(persistent);
redirectUrl = "role!list.action";
return SUCCESS;
}
示例3: settingUpdate
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@Validations(
requiredFields = {
@RequiredFieldValidator(fieldName = "leaveMessageDisplayType", message = "显示方式不允许为空!")
}
)
@InputConfig(resultName = "error")
public String settingUpdate() {
Setting setting = SettingUtil.getSetting();
setting.setIsLeaveMessageEnabled(isLeaveMessageEnabled);
setting.setIsLeaveMessageCaptchaEnabled(isLeaveMessageCaptchaEnabled);
setting.setLeaveMessageDisplayType(leaveMessageDisplayType);
SettingUtil.updateSetting(setting);
cacheService.flushLeaveMessagePageCache(getRequest());
redirectUrl = "leave_message!setting.action";
return SUCCESS;
}
示例4: add
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@Validations(
requiredFields = {
@RequiredFieldValidator(fieldName = "paymentConfig.paymentConfigType", message = "支付配置类型不允许为空!")
}
)
@InputConfig(resultName = "error")
public String add() {
if (paymentConfig.getPaymentConfigType() == PaymentConfigType.online) {
paymentProduct = PaymentProductUtil.getPaymentProduct(paymentConfig.getPaymentProductId());
if (paymentProduct == null) {
addActionError("支付产品配置不存在!");
return ERROR;
}
}
return INPUT;
}
示例5: settingUpdate
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@Validations(
requiredFields = {
@RequiredFieldValidator(fieldName = "commentAuthority", message = "评论发表权限不允许为空!"),
@RequiredFieldValidator(fieldName = "commentDisplayType", message = "显示方式不允许为空!")
}
)
@InputConfig(resultName = "error")
public String settingUpdate() {
Setting setting = SettingUtil.getSetting();
setting.setIsCommentEnabled(isCommentEnabled);
setting.setIsCommentCaptchaEnabled(isCommentCaptchaEnabled);
setting.setCommentAuthority(commentAuthority);
setting.setCommentDisplayType(commentDisplayType);
SettingUtil.updateSetting(setting);
jobService.buildShopJs();
jobService.buildGoodsContentHtml();
redirectUrl = "comment!setting.action";
return SUCCESS;
}
示例6: save
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@Validations(
fieldExpressions = {
@FieldExpressionValidator(fieldName = "project.experiment.experimentDesignTypes",
message = "", key = "struts.validator.requiredString",
expression = "!project.experiment.experimentDesignTypes.isEmpty")
},
requiredFields = {
@RequiredFieldValidator(fieldName = "project.experiment.designDescription",
key = "errors.required", message = "")
}
)
@SuppressWarnings("PMD.UselessOverridingMethod")
public String save() {
return super.save();
}
示例7: setChannelGroupNumber
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@ConversionErrorFieldValidator(
key = "ConversionErrorFieldValidator.error",
shortCircuit = true
)
@RequiredFieldValidator(
key = "RequiredFieldValidator.error",
shortCircuit = true
)
@IntRangeFieldValidator(
key = "IntRangeFieldValidator.error.min.max",
min = "1",
max = "4094",
shortCircuit = true
)
public void setChannelGroupNumber(Integer channelGroupNumber) {
this.channelGroupNumber = channelGroupNumber;
}
示例8: setPrefixLength
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@ConversionErrorFieldValidator(
key = "ConversionErrorFieldValidator.error",
shortCircuit = true
)
@RequiredFieldValidator(
key = "RequiredFieldValidator.error",
shortCircuit = true
)
@IntRangeFieldValidator(
key = "IntRangeFieldValidator.error.min.max",
min = "0",
max = "128",
shortCircuit = true
)
public void setPrefixLength(Integer prefixLength) {
this.prefixLength = prefixLength;
}
示例9: setMetric
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@ConversionErrorFieldValidator(
key = "ConversionErrorFieldValidator.error",
shortCircuit = true
)
@RequiredFieldValidator(
key = "RequiredFieldValidator.error",
shortCircuit = true
)
@IntRangeFieldValidator(
key = "IntRangeFieldValidator.error.min.max",
min = "1",
max = "9999",
shortCircuit = true
)
public void setMetric(Integer metric) {
this.metric = metric;
}
示例10: setPort
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@ConversionErrorFieldValidator(
key = "ConversionErrorFieldValidator.error",
shortCircuit = true
)
@RequiredFieldValidator(
key = "RequiredFieldValidator.error",
shortCircuit = true
)
@IntRangeFieldValidator(
key = "IntRangeFieldValidator.error.min.max",
min = "1",
max = "65535",
shortCircuit = true
)
public void setPort(Integer port) {
this.port = port;
}
示例11: setVid
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@ConversionErrorFieldValidator(
key = "ConversionErrorFieldValidator.error",
shortCircuit = true
)
@RequiredFieldValidator(
key = "RequiredFieldValidator.error",
shortCircuit = true
)
@IntRangeFieldValidator(
key = "IntRangeFieldValidator.error.min.max",
min = "1",
max = "4094",
shortCircuit = true
)
public void setVid(Integer vid) {
this.vid = vid;
}
示例12: setTtl
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@ConversionErrorFieldValidator(
key = "ConversionErrorFieldValidator.error",
shortCircuit = true
)
@RequiredFieldValidator(
key = "RequiredFieldValidator.error",
shortCircuit = true
)
@IntRangeFieldValidator(
key = "IntRangeFieldValidator.error.min.max",
min = "0",
max = "255",
shortCircuit = true
)
public void setTtl(Integer ttl) {
this.ttl = ttl;
}
示例13: setPrefixLength
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@ConversionErrorFieldValidator(
key = "ConversionErrorFieldValidator.error",
shortCircuit = true
)
@RequiredFieldValidator(
key = "RequiredFieldValidator.error",
shortCircuit = true
)
@IntRangeFieldValidator(
key = "IntRangeFieldValidator.error.min.max",
min = "0",
max = "128",
shortCircuit = true
)
@CustomValidator(
key = "IpAddressPrefixLengthValidator.error",
type = "ipaddressprefixlength"
)
public void setPrefixLength(Integer prefixLength) {
this.prefixLength = prefixLength;
}
示例14: save
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@Validations(
requiredStrings = {
@RequiredStringValidator(fieldName = "memberAttribute.name", message = "注册项名称不允许为空!")
},
requiredFields = {
@RequiredFieldValidator(fieldName = "memberAttribute.attributeType", message = "注册项类型不允许为空!")
},
intRangeFields = {
@IntRangeFieldValidator(fieldName = "memberAttribute.orderList", min = "0", message = "排序必须为零或正整数!")
}
)
@InputConfig(resultName = "error")
public String save() {
if (memberAttribute.getAttributeType() == AttributeType.select || memberAttribute.getAttributeType() == AttributeType.checkbox) {
if(optionList == null || optionList.size() < 1) {
addActionError("请至少填写一个选项内容!");
return ERROR;
}
Iterator<String> iterator = optionList.iterator();
while (iterator.hasNext()) {
String option = (String) iterator.next();
if (StringUtils.isEmpty(option)) {
iterator.remove();
}
}
memberAttribute.setOptionList(optionList);
} else {
memberAttribute.setOptionList(null);
}
memberAttribute.setSystemAttributeType(null);
Integer propertyIndex = memberAttributeService.getUnusedPropertyIndex();
if (propertyIndex == null) {
addActionError("最多只允许添加" + Member.MEMBER_ATTRIBUTE_VALUE_PROPERTY_COUNT + "个非系统默认会员注册项!");
return ERROR;
}
memberAttribute.setPropertyIndex(propertyIndex);
memberAttributeService.save(memberAttribute);
redirectUrl = "member_attribute!list.action";
return SUCCESS;
}
示例15: save
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@Validations(
requiredStrings = {
@RequiredStringValidator(fieldName = "deliveryType.name", message = "配送方式名称不允许为空!")
},
requiredFields = {
@RequiredFieldValidator(fieldName = "deliveryType.deliveryMethod", message = "配送类型不允许为空!"),
@RequiredFieldValidator(fieldName = "deliveryType.firstWeight", message = "首重量不允许为空!"),
@RequiredFieldValidator(fieldName = "deliveryType.continueWeight", message = "续重量不允许为空!"),
@RequiredFieldValidator(fieldName = "deliveryType.firstWeightPrice", message = "首重价格不允许为空!"),
@RequiredFieldValidator(fieldName = "deliveryType.continueWeightPrice", message = "续重价格不允许为空!")
},
intRangeFields = {
@IntRangeFieldValidator(fieldName = "deliveryType.firstWeight", min = "0", message = "首重量必须为零或正整数!"),
@IntRangeFieldValidator(fieldName = "deliveryType.continueWeight", min = "1", message = "续重量必须为正整数!"),
@IntRangeFieldValidator(fieldName = "deliveryType.orderList", min = "0", message = "排序必须为零或正整数!")
}
)
@InputConfig(resultName = "error")
public String save() {
if (deliveryType.getFirstWeightPrice().compareTo(new BigDecimal(0)) < 0) {
addActionError("首重价格不允许小于0");
return ERROR;
}
if (deliveryType.getContinueWeightPrice().compareTo(new BigDecimal(0)) < 0) {
addActionError("续重价格不允许小于0");
return ERROR;
}
if (StringUtils.isEmpty(deliveryType.getDefaultDeliveryCorp().getId())) {
deliveryType.setDefaultDeliveryCorp(null);
}
deliveryTypeService.save(deliveryType);
redirectUrl = "delivery_type!list.action";
return SUCCESS;
}