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

外贸营销网站建设工程免费网站域名使用

外贸营销网站建设工程,免费网站域名使用,东莞普工招聘最新招聘信息,wordpress进不去数据库jQueryEasyUI详解 jQuery EasyUI是一组基于jQuery的UI插件集合体#xff0c;而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。 开发者不需要编写复杂的javascript#xff0c;也不需要对css样式有深入的了解#xff0c;开发者需要了解的只…jQueryEasyUI详解 jQuery EasyUI是一组基于jQuery的UI插件集合体而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。 开发者不需要编写复杂的javascript也不需要对css样式有深入的了解开发者需要了解的只有一些简单的html标签。 如何使用EasyUI插件 datagrid向用户展示列表数据。dialog创建或编辑一条单一的用户信息。form用于提交表单数据。messager显示一些操作信息。对user表进行CRUD分页简单查询 列表 新增 修改 项目图片 初始化类InitApplicationListener 在启动服务器的时候插入默认已知数据 package com.jege.spring.boot.controller;import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.stereotype.Component;import com.jege.spring.boot.data.jpa.entity.User; import com.jege.spring.boot.data.jpa.repository.UserRepository;/*** spring的事件监听器的处理机制在启动服务器的时候插入默认数据*/ Component public class InitApplicationListener implements ApplicationListenerContextRefreshedEvent {Overridepublic void onApplicationEvent(ContextRefreshedEvent event) {ApplicationContext context event.getApplicationContext();UserRepository userRepository context.getBean(userRepository, UserRepository.class);for (int i 1; i 21; i) {User user new User(user i, 25 i);userRepository.save(user);}}} 全局异常处理CommonExceptionAdvice 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% script typetext/javascript// 页面加载完毕之后才能写jQuery的代码$(function() {// 声明并缓存easyui组件var userDatagrid $(#userDatagrid);var userDialog $(#userDialog);var userForm $(#userForm);var userSearchForm $(#userSearchForm);// 表单的添加方法userForm.form({url : /user/save,onSubmit : function() {// 在表单提交前做一下验证return userForm.form(validate);},//data是后台save方法返回的json字符串success : function(data) {// 需要自己把字符串转变成json对象easyiui没有提供转换data $.parseJSON(data);// 判断保存是否成功if (data.meta.success) {// 成功就关掉对话框userDialog.dialog(close);//重新加载最新的数据userDatagrid.datagrid(reload);} else {$.messager.alert(错误提示, data.meta.message, error);}}});// 创建操作data-url的json对象把页面所有linkbutton组件的操作都统一添加到此对象上面var urlObjectUser {addUser : function() {// 清空对话框里面的表单内容防止原来的数据有缓存userForm.form(clear);// 打开对话框修改标题然后居中userDialog.dialog(open).dialog(setTitle, 添加用户);},updateUser : function() {// 获取选中行数据var selectedRow userDatagrid.datagrid(getSelected);// 判断是否选中行if (!selectedRow) {$.messager.alert(操作提示, 请先选中一行数据在修改, info);return;}// 清空对话框里面的表单内容userForm.form(clear);//修改的时候才查询上级null数据$(#parentCombotree).combotree({url : ${ctx}/user/getTreeByParent});// 使用easyui的form组件load方法只要是相同的名称会自动回显数据userForm.form(load, selectedRow);// 打开对话框userDialog.dialog(open).dialog(setTitle, 编辑用户);},removeUser : function() {// 获取选中行数据var row userDatagrid.datagrid(getSelected);// 判断是否选中行if (!row) {$.messager.alert(操作提示, 请选中一行数据在删除, info);return;}$.get(/user/delete?id row.id, function(data) {if (data.meta.success) {//删除成功userDatagrid.datagrid(reload);} else {$.messager.alert(错误提示, data.meta.message, error);}}, json);},reloadUser : function() {//调用重新加载数据的方法userDatagrid.datagrid(reload);},saveUser : function() {//提交表单userForm.submit();},cancelUser : function() {//关闭对话框userDialog.dialog(close);},searchUser : function() {//简单搜索userDatagrid.datagrid(load, {q : $(input[nameq]).val()});}};// 对页面所有linkbutton组件统一监听$(a[data-url]).on(click, function() {// 获取linkbutton的data-url信息 var url $(this).data(url);//如果此目标方法是存在的并且linkbutton组件没有被禁用才可以点击if (urlObjectUser[url] !$(this).linkbutton(options).disabled) {//调用动态的方法urlObjectUser[url]();}});}); /script /head body!-- 数据表格组件 --table iduserDatagrid classeasyui-datagrid url/user/json title用户管理 fittrue borderfalsefitColumnstrue singleSelecttrue paginationtrue rownumberstrue toolbar#userDatagridToolbartheadtrth data-optionsfield:id编号/thth data-optionsfield:name,width:10名称/thth data-optionsfield:age,width:10年龄/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 data-urladdUser hrefjavascript:void(0) classeasyui-linkbutton c1 iconClsicon-add添加/a adata-urlupdateUser hrefjavascript:void(0) classeasyui-linkbutton c2 iconClsicon-edit编辑/a adata-urlremoveUser hrefjavascript:void(0) classeasyui-linkbutton c3 iconClsicon-remove删除/aa data-urlreloadUser hrefjavascript:void(0) classeasyui-linkbutton c4 iconClsicon-reload刷新/aa hrefjavascript:void(0) classeasyui-linkbutton c8 iconClsicon-search data-urlsearchUserdisabledtrue不能点击的按钮,点击了也没有事件处理/a/divdiv stylefloat: rightform methodpost关键字input nameq size10 / a data-urlsearchUser hrefjavascript:void(0)classeasyui-linkbutton c5 iconClsicon-search搜索/a/form/div/div/div!-- 添加/编辑用户对话框 --div iduserDialog classeasyui-dialog stylewidth: 360px; height: 260px; padding: 10px 20pxtitle管理用户对话框 data-optionsclosed:true,modal:true,buttons:#userDialogButtons,resizable:trueform iduserForm methodpostinput typehidden nameid /div classftitle用户信息/divtable aligncentertrtd名称:/tdtdinput classeasyui-validatebox requiredtrue typetext namename/input/td/trtrtd年龄:/tdtdinput classeasyui-numberbox requiredtrue min20 max80 precision0 typetextnameage/input/td/tr/table/form/div!-- 对话框按钮组件 --div iduserDialogButtonsa data-urlsaveUser hrefjavascript:void(0) classeasyui-linkbutton c6 iconClsicon-okstylewidth: 90px保存/a a data-urlcancelUser hrefjavascript:void(0) classeasyui-linkbutton c7iconClsicon-cancel stylewidth: 90px取消/a/div /body /html扫一扫关注和我共同进步哟
http://wiki.neutronadmin.com/news/338672/

相关文章:

  • 龙岗做网站哪里找图标设计网站
  • 网站开发语言比较简单的网页设计模板
  • 宁波外贸网站建设有哪些seo基础入门
  • 徐州服饰网站建设无锡建设教育协会网站
  • 本地南京网站建设宁波优化系统
  • 一级域名网站上下篇文章wordpress
  • 沈阳网站订制调研园区网站建设工作
  • wordpress多媒体插件南京百度seo
  • 如何把自己做的网站连上网莱芜网络推广公司电话
  • 开工作室做网站怎样找资源兴县网站建设
  • 网站开发架构图泰兴做网站电话
  • 无锡市建设安全监督网站网页广告怎么去除
  • 新手建站网站开发授权书
  • 建设银行公户网站网站建设怎么好
  • 万盛经开区建设局官方网站做网站广告哪家好
  • 网站建设公司兴田德润i优惠吗商城网站素材
  • 网站制作收费明细表百度推广业务员电话
  • 建站步骤图网络营销有必要学吗
  • 郑州虚拟货币网站开发订单网站模块
  • 网站建设代码上海网站建设的报价
  • 制作网站平台玉器珠宝做网站
  • 批量网站建设网站 优化 分析
  • 基于python网站开发重庆网站公司设计方案
  • 番禺电商网站建设北京网站制作案例
  • 哪个网站做二手叉车回收好建设工程价款结算暂行办法
  • 有什么网站可以接设计做金融专业主要学什么
  • 岳阳网站开发公司推荐wordpress去掉首页
  • server2008做DNS与网站怎样做网站推广
  • 文化传播公司做网站宣传好吗做网站一定要云解析吗
  • 推荐几个看黄的网站数据库与网站