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


Java Validations类代码示例

本文整理汇总了Java中com.opensymphony.xwork2.validator.annotations.Validations的典型用法代码示例。如果您正苦于以下问题:Java Validations类的具体用法?Java Validations怎么用?Java Validations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Validations类属于com.opensymphony.xwork2.validator.annotations包,在下文中一共展示了Validations类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "templateFileContent", message = "模板内容不允许为空!")
	}
)
@InputConfig(resultName = "error")
public String update() {
	pageTemplateConfig = TemplateConfigUtil.getPageTemplateConfig(pageTemplateConfig.getName());
	TemplateConfigUtil.writeTemplateFileContent(pageTemplateConfig, templateFileContent);
	try {
		freemarkerManager.getConfiguration(getServletContext()).clearTemplateCache();
	} catch (TemplateException e) {
		e.printStackTrace();
	}
	redirectUrl = "page_template!list.action";
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:18,代码来源:PageTemplateAction.java

示例2: save

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "friendLink.name", message = "友情链接名称不允许为空!"),
		@RequiredStringValidator(fieldName = "friendLink.url", message = "链接地址不允许为空!")
	},
	intRangeFields = {
		@IntRangeFieldValidator(fieldName = "friendLink.orderList", min = "0", message = "排序必须为零或正整数!")
	}
)
@InputConfig(resultName = "error")
public String save() throws Exception {
	if (logo != null) {
		String logoPath = ImageUtil.copyImageFile(getServletContext(), logo);
		friendLink.setLogoPath(logoPath);
	} else {
		friendLink.setLogoPath(null);
	}
	friendLinkService.save(friendLink);
	redirectUrl = "friend_link!list.action";
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:22,代码来源:FriendLinkAction.java

示例3: update

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "friendLink.name", message = "友情链接名称不允许为空!"),
		@RequiredStringValidator(fieldName = "friendLink.url", message = "链接地址不允许为空!")
	},
	intRangeFields = {
		@IntRangeFieldValidator(fieldName = "friendLink.orderList", min = "0", message = "排序必须为零或正整数!")
	}
)
@InputConfig(resultName = "error")
public String update() throws Exception {
	FriendLink persistent = friendLinkService.load(id);
	if (logo != null) {
		String logoPath = ImageUtil.copyImageFile(getServletContext(), logo);
		persistent.setLogoPath(logoPath);
	}
	BeanUtils.copyProperties(friendLink, persistent, new String[]{"id", "createDate", "modifyDate", "logoPath"});
	friendLinkService.update(persistent);
	redirectUrl = "friend_link!list.action";
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:22,代码来源:FriendLinkAction.java

示例4: update

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "admin.email", message = "E-mail不允许为空!")
	}, 
	stringLengthFields = {
		@StringLengthFieldValidator(fieldName = "admin.password", minLength = "4", maxLength = "20", message = "新密码长度允许在{1}-{2}之间!") 
	}, 
	emails = { 
		@EmailValidator(fieldName = "admin.email", message = "E-mail格式错误!")
	}
)
@InputConfig(resultName = "error")
public String update() {
	Admin persistent = adminService.loadLoginAdmin();
	if (StringUtils.isNotEmpty(currentPassword) && StringUtils.isNotEmpty(admin.getPassword())) {
		if (!StringUtils.equals(DigestUtils.md5Hex(currentPassword), persistent.getPassword())) {
			addActionError("当前密码输入错误!");
			return ERROR;
		}
		persistent.setPassword(DigestUtils.md5Hex(admin.getPassword()));
	}
	persistent.setEmail(admin.getEmail());
	adminService.update(persistent);
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:26,代码来源:AdminProfileAction.java

示例5: save

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的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

示例6: update

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的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

示例7: update

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "templateFileContent", message = "模板内容不允许为空!")
	}
)
@InputConfig(resultName = "error")
public String update() {
	printTemplateConfig = TemplateConfigUtil.getPrintTemplateConfig(printTemplateConfig.getName());
	TemplateConfigUtil.writeTemplateFileContent(printTemplateConfig, templateFileContent);
	try {
		freemarkerManager.getConfiguration(getServletContext()).clearTemplateCache();
	} catch (TemplateException e) {
		e.printStackTrace();
	}
	redirectUrl = "print_template!list.action";
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:18,代码来源:PrintTemplateAction.java

示例8: reply

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = {
		@RequiredStringValidator(fieldName = "leaveMessage.title", message = "标题不允许为空!"),
		@RequiredStringValidator(fieldName = "leaveMessage.content", message = "内容不允许为空!")
	}
)
@InputConfig(resultName = "error")
public String reply() {
	LeaveMessage forLeaveMessage = leaveMessageService.load(id);
	leaveMessage.setUsername(null);
	leaveMessage.setContact(null);
	leaveMessage.setIp(getRequest().getRemoteAddr());
	leaveMessage.setForLeaveMessage(forLeaveMessage);
	leaveMessageService.save(leaveMessage);
	cacheService.flushLeaveMessagePageCache(getRequest());
	redirectUrl = "leave_message!view.action?id=" + forLeaveMessage.getId();
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:19,代码来源:LeaveMessageAction.java

示例9: settingUpdate

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的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

示例10: save

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "brand.name", message = "品牌名称不允许为空!")
	},
	intRangeFields = {
		@IntRangeFieldValidator(fieldName = "brand.orderList", min = "0", message = "排序必须为零或正整数!")
	}
)
@InputConfig(resultName = "error")
public String save() throws Exception {
	if (logo != null) {
		String logoPath = ImageUtil.copyImageFile(getServletContext(), logo);
		brand.setLogoPath(logoPath);
	} else {
		brand.setLogoPath(null);
	}
	brandService.save(brand);
	redirectUrl = "brand!list.action";
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:21,代码来源:BrandAction.java

示例11: update

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "brand.name", message = "品牌名称不允许为空!")
	},
	intRangeFields = {
		@IntRangeFieldValidator(fieldName = "brand.orderList", min = "0", message = "排序必须为零或正整数!")
	}
)
@InputConfig(resultName = "error")
public String update() throws Exception {
	Brand persistent = brandService.load(id);
	if (logo != null) {
		String logoPath = ImageUtil.copyImageFile(getServletContext(), logo);
		persistent.setLogoPath(logoPath);
	}
	BeanUtils.copyProperties(brand, persistent, new String[]{"id", "createDate", "modifyDate", "logoPath", "goodsSet", "goodsTypeSet"});
	brandService.update(persistent);
	
	redirectUrl = "brand!list.action";
	cacheService.flushGoodsListPageCache(getRequest());
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:23,代码来源:BrandAction.java

示例12: save

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = {
		@RequiredStringValidator(fieldName = "toMemberUsername", message = "收件人不允许为空!"),
		@RequiredStringValidator(fieldName = "message.title", message = "标题不允许为空!"),
		@RequiredStringValidator(fieldName = "message.content", message = "消息内容不允许为空!")
	},
	stringLengthFields = {
		@StringLengthFieldValidator(fieldName = "message.content", maxLength = "10000", message = "消息内容长度超出限制!")
	}
)
@InputConfig(resultName = "error")
public String save() {
	Member toMember = memberService.getMemberByUsername(toMemberUsername);
	if (toMember == null) {
		addActionError("收件人不存在!");
		return ERROR;
	}
	message.setToMember(toMember);
	message.setFromMember(null);
	message.setDeleteStatus(DeleteStatus.nonDelete);
	message.setIsRead(false);
	message.setIsSaveDraftbox(false);
	messageService.save(message);
	redirectUrl = "message!outbox.action";
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:27,代码来源:MessageAction.java

示例13: save

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "area.name", message = "名称不允许为空!")
	},
	intRangeFields = {
		@IntRangeFieldValidator(fieldName = "area.orderList", min = "0", message = "排序必须为零或正整数!")
	}
)
@InputConfig(resultName = "error")
public String save() {
	if (StringUtils.isNotEmpty(parentId)) {
		area.setParent(areaService.load(parentId));
	} else {
		area.setParent(null);
	}
	areaService.save(area);
	redirectUrl = "area!list.action?parentId=" + parentId;
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:20,代码来源:AreaAction.java

示例14: update

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "area.name", message = "名称不允许为空!")
	},
	intRangeFields = {
		@IntRangeFieldValidator(fieldName = "area.orderList", min = "0", message = "排序必须为零或正整数!")
	}
)
public String update() {
	Area persistent = areaService.load(id);
	Area parent = persistent.getParent();
	if (parent != null) {
		parentId = parent.getId();
	}
	persistent.setName(area.getName());
	persistent.setOrderList(area.getOrderList());
	areaService.update(persistent);
	redirectUrl = "area!list.action?parentId=" + parentId;
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:21,代码来源:AreaAction.java

示例15: add

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的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


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