• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Validations类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: save

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "article.title", message = "标题不允许为空!"),
		@RequiredStringValidator(fieldName = "article.content", message = "内容不允许为空!"),
		@RequiredStringValidator(fieldName = "article.articleCategory.id", message = "文章分类不允许为空!")
	}
)
@InputConfig(resultName = "error")
public String save() throws Exception {
	articleService.save(article);
	logInfo = "添加文章: " + article.getTitle();
	
	cacheService.flushArticleListPageCache(getRequest());
	
	redirectUrl = "article!list.action";
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:18,代码来源:ArticleAction.java


示例17: update

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "article.title", message = "标题不允许为空!"),
		@RequiredStringValidator(fieldName = "article.content", message = "内容不允许为空!"),
		@RequiredStringValidator(fieldName = "article.articleCategory.id", message = "文章分类不允许为空!")
	}
)
@InputConfig(resultName = "error")
public String update() throws Exception {
	Article persistent = articleService.load(id);
	BeanUtils.copyProperties(article, persistent, new String[] {"id", "createDate", "modifyDate", "pageCount", "htmlPath", "hits"});
	articleService.update(persistent);
	logInfo = "编辑文章: " + article.getTitle();
	
	cacheService.flushArticleListPageCache(getRequest());
	
	redirectUrl = "article!list.action";
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:20,代码来源:ArticleAction.java


示例18: update

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "deliveryCorp.name", message = "物流公司名称不允许为空!")
	},
	intRangeFields = {
		@IntRangeFieldValidator(fieldName = "deliveryCorp.orderList", min = "0", message = "排序必须为零或正整数!")
	}
)
@InputConfig(resultName = "error")
public String update() {
	DeliveryCorp persistent = deliveryCorpService.load(id);
	BeanUtils.copyProperties(deliveryCorp, persistent, new String[]{"id", "createDate", "modifyDate", "deliveryTypeSet"});
	deliveryCorpService.update(persistent);
	redirectUrl = "delivery_corp!list.action";
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:17,代码来源:DeliveryCorpAction.java


示例19: update

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


示例20: update

import com.opensymphony.xwork2.validator.annotations.Validations; //导入依赖的package包/类
@Validations(
	requiredStrings = { 
		@RequiredStringValidator(fieldName = "navigation.name", message = "导航名称不允许为空!"),
		@RequiredStringValidator(fieldName = "navigation.url", message = "链接地址不允许为空!")
	}, 
	intRangeFields = {
		@IntRangeFieldValidator(fieldName = "navigation.orderList", min = "0", message = "排序必须为零或正整数!")
	}
)
@InputConfig(resultName = "error")
public String update() {
	Navigation persistent = navigationService.load(id);
	BeanUtils.copyProperties(navigation, persistent, new String[]{"id", "createDate", "modifyDate"});
	navigationService.update(persistent);
	redirectUrl = "navigation!list.action";
	return SUCCESS;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:18,代码来源:NavigationAction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BaseDaoEnabled类代码示例发布时间:2022-05-22
下一篇:
Java PrivateKeyFactoryBean类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap