本文整理汇总了Java中com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator类的典型用法代码示例。如果您正苦于以下问题:Java RequiredFieldValidator类的具体用法?Java RequiredFieldValidator怎么用?Java RequiredFieldValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequiredFieldValidator类属于com.opensymphony.xwork2.validator.annotations包,在下文中一共展示了RequiredFieldValidator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:18,代码来源:RoleAction.java
示例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;
}
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:24,代码来源:RoleAction.java
示例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;
}
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:17,代码来源:LeaveMessageAction.java
示例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;
}
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:17,代码来源:PaymentConfigAction.java
示例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;
}
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:22,代码来源:CommentAction.java
示例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();
}
开发者ID:NCIP,项目名称:caarray,代码行数:20,代码来源:ProjectExperimentalDesignAction.java
示例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;
}
开发者ID:kaitoy,项目名称:sneo,代码行数:18,代码来源:Lag.java
示例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;
}
开发者ID:kaitoy,项目名称:sneo,代码行数:18,代码来源:IpV6Route.java
示例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;
}
开发者ID:kaitoy,项目名称:sneo,代码行数:18,代码来源:IpV6Route.java
示例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;
}
开发者ID:kaitoy,项目名称:sneo,代码行数:18,代码来源:TrapTarget.java
示例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;
}
开发者ID:kaitoy,项目名称:sneo,代码行数:18,代码来源:Vlan.java
示例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;
}
开发者ID:kaitoy,项目名称:sneo,代码行数:18,代码来源:Node.java
示例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;
}
开发者ID:kaitoy,项目名称:sneo,代码行数:22,代码来源:IpAddress.java
示例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;
}
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:41,代码来源:MemberAttributeAction.java
示例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;
}
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:35,代码来源:DeliveryTypeAction.java
示例16: update
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 update() {
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);
}
DeliveryType persistent = deliveryTypeService.load(id);
BeanUtils.copyProperties(deliveryType, persistent, new String[]{"id", "createDate", "modifyDate", "orderSet", "shippingSet", "reshipSet"});
deliveryTypeService.update(persistent);
redirectUrl = "delivery_type!list.action";
return SUCCESS;
}
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:37,代码来源:DeliveryTypeAction.java
示例17: save
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@Validations(
requiredStrings = {
@RequiredStringValidator(fieldName = "memberRank.name", message = "等级名称不允许为空!")
},
requiredFields = {
@RequiredFieldValidator(fieldName = "memberRank.preferentialScale", message = "优惠百分比不允许为空!"),
@RequiredFieldValidator(fieldName = "memberRank.score", message = "所需积分不允许为空!")
},
intRangeFields = {
@IntRangeFieldValidator(fieldName = "memberRank.score", min = "0", message = "所需积分只允许为正整数或零!")
}
)
@InputConfig(resultName = "error")
public String save() {
if (memberRankService.isExistByName(memberRank.getName())) {
addActionError("名称已存在!");
return ERROR;
}
if (memberRank.getPreferentialScale() < 0) {
addActionError("优惠百分比必须大于或等于零!");
return ERROR;
}
if (memberRankService.getMemberRankByScore(memberRank.getScore()) != null) {
addActionError("已存在相同积分的会员等级!");
return ERROR;
}
memberRankService.save(memberRank);
redirectUrl = "member_rank!list.action";
return SUCCESS;
}
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:31,代码来源:MemberRankAction.java
示例18: update
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
@Validations(
requiredStrings = {
@RequiredStringValidator(fieldName = "memberRank.name", message = "等级名称不允许为空!")
},
requiredFields = {
@RequiredFieldValidator(fieldName = "memberRank.preferentialScale", message = "优惠百分比不允许为空!"),
@RequiredFieldValidator(fieldName = "memberRank.score", message = "所需积分不允许为空!")
},
intRangeFields = {
@IntRangeFieldValidator(fieldName = "memberRank.score", min = "0", message = "所需积分只允许为正整数或零!")
}
)
@InputConfig(resultName = "error")
public String update() {
MemberRank persistent = memberRankService.load(id);
if (!memberRankService.isUniqueByName(persistent.getName(), memberRank.getName())) {
addActionError("名称已存在!");
return ERROR;
}
if (memberRank.getPreferentialScale() < 0) {
addActionError("优惠百分比必须大于或等于零!");
return ERROR;
}
MemberRank equalScoreMemberRank = memberRankService.getMemberRankByScore(memberRank.getScore());
if (equalScoreMemberRank != null && equalScoreMemberRank != persistent) {
addActionError("已存在相同积分的会员等级!");
return ERROR;
}
BeanUtils.copyProperties(memberRank, persistent, new String[] {"id", "createDate", "modifyDate", "memberSet"});
memberRankService.update(persistent);
redirectUrl = "member_rank!list.action";
return SUCCESS;
}
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:34,代码来源:MemberRankAction.java
示例19: save
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@UrlValidator(message = "", fieldName = "currentPublication.uri", key = "struts.validator.url")
@RequiredFieldValidator(message = "", fieldName = "currentPublication.title",
key = "struts.validator.requiredString")
public String save() { //NOPMD
return super.save();
}
开发者ID:NCIP,项目名称:caarray,代码行数:11,代码来源:ProjectPublicationsAction.java
示例20: saveMeta
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator; //导入依赖的package包/类
/**
* Save a new or existing array design.
*
* @return success
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
@Validations(
fieldExpressions = {@FieldExpressionValidator(fieldName = "arrayDesign.assayTypes", message = "",
key = "errors.required", expression = "!arrayDesign.assayTypes.isEmpty") },
requiredStrings = {@RequiredStringValidator(fieldName = "arrayDesign.version", key = "errors.required",
message = "") },
requiredFields = {
@RequiredFieldValidator(fieldName = "arrayDesign.provider", key = "errors.required", message = ""),
@RequiredFieldValidator(fieldName = "arrayDesign.technologyType", key = "errors.required",
message = ""),
@RequiredFieldValidator(fieldName = "arrayDesign.organism", key = "errors.required", message = "") })
/**
* Save the array design metadata.
*/
public
String saveMeta() {
if (!this.createMode && this.editMode) {
if (ServiceLocatorFactory.getArrayDesignService().isDuplicate(this.arrayDesign)) {
ActionHelper.saveMessage(getText("arraydesign.duplicate", new String[] {getArrayDesign().getName() }));
return Action.INPUT;
}
saveImportFile();
final List<Object> args = new ArrayList<Object>();
args.add(getArrayDesign().getName());
args.add(getArrayDesign().getProvider().getName());
ActionHelper.saveMessage(getText("arraydesign.saved", args));
return Action.SUCCESS;
}
this.editMode = true;
return "metaValid";
}
开发者ID:NCIP,项目名称:caarray,代码行数:39,代码来源:ArrayDesignAction.java
注:本文中的com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论