当前位置: 首页 > news >正文

付费网站搭建商丘企业网站建设推荐

付费网站搭建,商丘企业网站建设推荐,搜狗搜索引擎网页,小米发布会在哪里看edatagrid扩展组件详解 edatagrid组件是datagrid的扩展组件#xff0c;增加了统一处理CRUD的功能#xff0c;可以用在数据比较简单的页面。使用的时候需要额外引入jquery.edatagrid.js为了能够把后台自动捕获的异常显示到前台这里必须使用最新版本的jquery.edatagrid.js文件能…edatagrid扩展组件详解 edatagrid组件是datagrid的扩展组件增加了统一处理CRUD的功能可以用在数据比较简单的页面。使用的时候需要额外引入jquery.edatagrid.js为了能够把后台自动捕获的异常显示到前台这里必须使用最新版本的jquery.edatagrid.js文件能够直接在数据表格里面进行CRUD 列表 新增 修改 删除 删除异常 项目图片 AjaxResult.java改变输出属性适应edatagrid.onError方法 package com.jege.spring.boot.json;/*** 返回json对象*/ public class AjaxResult {private static final String OK ok;private static final String ERROR error;private boolean isError false;private String msg OK;public AjaxResult success() {return this;}public AjaxResult failure() {isError true;msg ERROR;return this;}public AjaxResult failure(String message) {isError true;msg message;return this;}public boolean getIsError() {return isError;}public void setIsError(boolean isError) {this.isError isError;}public String getMsg() {return msg;}public void setMsg(String msg) {this.msg msg;}} CommonExceptionAdvice.jave修改了返回的http状态 package com.jege.spring.boot.exception;import java.util.Set;import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolationException; import javax.validation.ValidationException;import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.http.HttpStatus; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.validation.BindException; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.HttpMediaTypeNotSupportedException; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.MissingServletRequestParameterException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus;import com.jege.spring.boot.json.AjaxResult;/*** 全局异常处理*/ ControllerAdvice ResponseBody public class CommonExceptionAdvice {private static Logger logger LoggerFactory.getLogger(CommonExceptionAdvice.class);/*** 400 - Bad Request*/ResponseStatus(HttpStatus.BAD_REQUEST)ExceptionHandler(MissingServletRequestParameterException.class)public AjaxResult handleMissingServletRequestParameterException(MissingServletRequestParameterException e) {logger.error(缺少请求参数, e);return new AjaxResult().failure(required_parameter_is_not_present);}/*** 400 - Bad Request*/ResponseStatus(HttpStatus.BAD_REQUEST)ExceptionHandler(HttpMessageNotReadableException.class)public AjaxResult handleHttpMessageNotReadableException(HttpMessageNotReadableException e) {logger.error(参数解析失败, e);return new AjaxResult().failure(could_not_read_json);}/*** 400 - Bad Request*/ResponseStatus(HttpStatus.BAD_REQUEST)ExceptionHandler(MethodArgumentNotValidException.class)public AjaxResult handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {logger.error(参数验证失败, e);BindingResult result e.getBindingResult();FieldError error result.getFieldError();String field error.getField();String code error.getDefaultMessage();String message String.format(%s:%s, field, code);return new AjaxResult().failure(message);}/*** 400 - Bad Request*/ResponseStatus(HttpStatus.BAD_REQUEST)ExceptionHandler(BindException.class)public AjaxResult handleBindException(BindException e) {logger.error(参数绑定失败, e);BindingResult result e.getBindingResult();FieldError error result.getFieldError();String field error.getField();String code error.getDefaultMessage();String message String.format(%s:%s, field, code);return new AjaxResult().failure(message);}/*** 400 - Bad Request*/ResponseStatus(HttpStatus.BAD_REQUEST)ExceptionHandler(ConstraintViolationException.class)public AjaxResult handleServiceException(ConstraintViolationException e) {logger.error(参数验证失败, e);SetConstraintViolation? violations e.getConstraintViolations();ConstraintViolation? violation violations.iterator().next();String message violation.getMessage();return new AjaxResult().failure(parameter: message);}/*** 400 - Bad Request*/ResponseStatus(HttpStatus.BAD_REQUEST)ExceptionHandler(ValidationException.class)public AjaxResult handleValidationException(ValidationException e) {logger.error(参数验证失败, e);return new AjaxResult().failure(validation_exception);}/*** 405 - Method Not Allowed*/ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED)ExceptionHandler(HttpRequestMethodNotSupportedException.class)public AjaxResult handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {logger.error(不支持当前请求方法, e);return new AjaxResult().failure(request_method_not_supported);}/*** 415 - Unsupported Media Type*/ResponseStatus(HttpStatus.UNSUPPORTED_MEDIA_TYPE)ExceptionHandler(HttpMediaTypeNotSupportedException.class)public AjaxResult handleHttpMediaTypeNotSupportedException(Exception e) {logger.error(不支持当前媒体类型, e);return new AjaxResult().failure(content_type_not_supported);}/*** 500 - Internal Server Error*/ResponseStatus(HttpStatus.OK)ExceptionHandler(ServiceException.class)public AjaxResult handleServiceException(ServiceException e) {logger.error(业务逻辑异常, e);return new AjaxResult().failure(业务逻辑异常 e.getMessage());}/*** 500 - Internal Server Error*/ResponseStatus(HttpStatus.OK)ExceptionHandler(Exception.class)public AjaxResult handleException(Exception e) {logger.error(通用异常, e);return new AjaxResult().failure(通用异常 e.getMessage());}/*** 操作数据库出现异常:名称重复外键关联*/ResponseStatus(HttpStatus.OK)ExceptionHandler(DataIntegrityViolationException.class)public AjaxResult handleException(DataIntegrityViolationException e) {logger.error(操作数据库出现异常:, e);return new AjaxResult().failure(操作数据库出现异常字段重复、有外键关联等);} }user.jsp有很大的变化 % page languagejava contentTypetext/html; charsetUTF-8 pageEncodingUTF-8% !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equivContent-Type contenttext/html; charsetUTF-8 title用户管理/title %include file/WEB-INF/page/common.jsp% !-- 额外添加的jquery.edatagrid.js -- script typetext/javascript src${ctx}/static/easyui/jquery.edatagrid.js/script script typetext/javascript// 页面加载完毕之后才能写jQuery的代码$(function() {$(#userDatagrid).edatagrid({url : /user/json,saveUrl : /user/save,updateUrl : /user/save,destroyUrl : /user/delete,onError : function(index, data) {$.messager.alert(错误提示, data.msg, error);}});}); /script /head body!-- 数据表格组件 --table iduserDatagrid title用户管理 fittrue borderfalse fitColumnstrue singleSelecttruepaginationtrue rownumberstrue toolbar#userDatagridToolbardata-optionsonSave:function(){$(#userDatagrid).edatagrid(reload);},destroyMsg:{norecord:{// 在没有记录选择的时候执行title:警告,msg:没有选择要删除的行!!!},confirm:{// 在选择一行的时候执行 title:确定,msg:你真的要删除吗?}}theadtrth data-optionsfield:id,hidden:true编号/thth fieldname width50 sortabletrue editor{type:validatebox,options:{required:true}}名称/thth fieldage width50 sortabletrueeditor{type:numberbox,options:{required:true,min:20,max:80,precision:0}}年龄/th/tr/thead/table!-- 数据表格组件工具栏 --div classeasyui-layout fittruediv iduserDatagridToolbar regionnorth borderfalsestyleborder-bottom: 1px solid #ddd; height: 32px; padding: 2px 5px; background: #fafafa;div stylefloat: left;a hrefjavascript:; onclickjavascript:$(#userDatagrid).edatagrid(addRow)classeasyui-linkbutton c1 iconClsicon-add添加/a a hrefjavascript:;onclickjavascript:$(#userDatagrid).edatagrid(saveRow) classeasyui-linkbutton c2iconClsicon-save保存/a a hrefjavascript:;onclickjavascript:$(#userDatagrid).edatagrid(destroyRow) classeasyui-linkbutton c3iconClsicon-remove删除/a a hrefjavascript:;onclickjavascript:$(#userDatagrid).edatagrid(cancelRow) classeasyui-linkbutton c4iconClsicon-cancel取消/aa hrefjavascript:;onclickjavascript:$(#userDatagrid).edatagrid(reload) classeasyui-linkbutton c5iconClsicon-reload刷新/a/divdiv stylefloat: rightform methodpost关键字input nameq size10 / a hrefjavascript:;onclickjavascript:$(#userDatagrid).edatagrid(load, {q : $(input[nameq]).val()});classeasyui-linkbutton c5 iconClsicon-search搜索/a/form/div/div/div /body /html如果感觉不错的话记得给我点赞哟
http://www.pierceye.com/news/550636/

相关文章:

  • 北京专业网站制作技术手机网站建好怎么发布
  • 谷歌网站建站wordpress 页面和文章
  • 网站建设基本目标如何建设 linux 网站
  • 电子商务网站开发 php汕头 网站建设
  • 郑州做网站的论坛山西利用模板建站
  • 网站引流.定期报告系统下载官网
  • 北京网站排名珠海 网页设计
  • 长春火车站防疫政策wordpress调用图片代码
  • 建设论坛网站自学江苏中小企业网站建设
  • 东莞网站建设效果好网站建设制作设计
  • 成华区建设局门户网站wordpress.fr
  • 河北制作网站模板建站公司网站开发流程的认识
  • 天津网站建设有哪些做网站的公司为什么人少了
  • 提供中山精品网站建设建俄语网站哪个公司最好
  • 建设银联官方网站怎样在网站做宣传
  • 网站开发支付宝二维码支付建设网站装配式建筑楼房
  • 湖北系统建站怎么用做网站买一个域名就够了吗
  • 如何做问卷调查网站济南网络公司
  • 纯js做网站Wordpress税
  • 建云科技网站首页阿里云 wordpress 安装
  • 浙江省建设工程协会网站动漫网站的设计与实现
  • wordpress能导出网站吗企业内部网站开发
  • 景观石网站建设方案一 网站开发背景
  • 开发app的平台外贸seo建站
  • 网站界面设计实训报告深圳设计公司办公室
  • 京东网站的公司地址别人网站建设多少钱
  • 如何加快网站打开速度wordpress注册怎样通过邮箱验证码
  • 有关图书网站建设策划书电脑公司网站系统源码
  • 西班牙网站后缀360收录提交入口网址
  • 济宁网站建设工程教育网官网学员登录