当前位置: 首页>>代码示例>>Java>>正文


Java RequiredFieldValidator类代码示例

本文整理汇总了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;
}
 
开发者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


注:本文中的com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。