文章标题
来源:互联网 发布:淘宝怎么临时卖东西 编辑:程序博客网 时间:2024/06/06 01:34
1.controller中返回ajax方式更改
添加@ResponseBody
方法返回ResultDTO
return ResultDTO.success(agreementDTO),调用静态方法,ResultDTO封装了ajax需要的参数。
判断是否为空,StringUtils.isEmpty
@RequestMapping(value ="/queryByNo", method = {RequestMethod.GET, RequestMethod.POST}) @ResponseBody public ResultDTO<AgreementDTO> queryByNo(String agreementNo) throws Exception{ AgreementDTO agreementDTO = null; if(!StringUtils.isEmpty(agreementNo)){ agreementDTO = agreementService.getAgreement(agreementNo); } return ResultDTO.success(agreementDTO); }
2.创建时编号onchange时间查询逻辑
更改前:
@RequestMapping(value ="/queryByNo", method = {RequestMethod.GET, RequestMethod.POST}) public ModelAndView queryByNo(String agreementNo) throws Exception{ //判空参考http://www.cnblogs.com/shangxiaofei/p/4313111.html //逻辑错误,不需要判断,也不能返回false。符合要求的直接调用方法即可。 if(agreementNo == null || agreementNo.equals("")){ return ajaxModelAndView(false); } AgreementDTO queryDTO = agreementService.getAgreement(agreementNo); //这里本意是想塞值回去。但可以在前台处理。删去。 if(queryDTO == null){ queryDTO.setAgreementNo(agreementNo); return newModelAndView().addObject("queryDTO", queryDTO); } return ajaxModelAndView(true).addObject("result", queryDTO); }
更改后:
@RequestMapping(value ="/queryByNo", method = {RequestMethod.GET, RequestMethod.POST}) @ResponseBody public ResultDTO<AgreementDTO> queryByNo(String agreementNo) throws Exception{ AgreementDTO agreementDTO = null; //非空时直接调用即可 if(!StringUtils.isEmpty(agreementNo)){ agreementDTO = agreementService.getAgreement(agreementNo); } return ResultDTO.success(agreementDTO); }
3.tiles框架内,default.jsp是模板,界面配置如下:
<div class="wrapper"> <tiles:insertAttribute name="header"/> <!-- Left side column. contains the sidebar --> <tiles:insertAttribute name="sidebar"/> <!-- =============================================== --> <!-- Content Wrapper. Contains page content --> <tiles:insertAttribute name="main"/> <!-- =============================================== --> <tiles:insertAttribute name="footer"/></div>
其他jsp页面嵌入<tiles:insertAttribute name="main"/>
中,故这些页面只需以<div class="content-wrapper">
开始即可。
4.chrome打断点
http://han.guokai.blog.163.com/blog/static/136718271201321402514114/
5.mapper接口映射过不去
<!-- 集成Mybatis --> <!-- Mybatis配置 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="configLocation" value="classpath:mybatis/mybatis-config.xml"></property> <property name="mapperLocations" value="classpath:mybatis/mapper/**/*.xml"></property> </bean> <!-- 自动扫描Mybatis的Mapper --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.ceair.acm.reservation.mapper" /> </bean>
其中
<!-- 自动扫描Mybatis的Mapper --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.ceair.acm.reservation.mapper" /> </bean>
mapper接口的路径和mapper.xml接口的namespace路径不同。映射失败。
6.mav模型返回jsp时,若是dto对象不能用循环遍历,不能使用<c:if test="${fn:length(insertDTO) > 0}">
,不能使用forEach遍历。
7.有问题首先看日志。
8.主键的自动生成
oracle主键的自动生成需要用到数据库的序列:SEQ_T_RES_COMMON.NEXTVAL
Mysql和。。需要用到insert属性:useGeneratedKeys。
insert时注意字段和值的次序一一对应。
阅读全文
0 0
- 文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题 文章标题 文章标题 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- JAVA正则表达式 Pattern和Matcher
- centos7 下安装Apache2+MariaDB+PHP5过程详解
- 快捷键
- 拼接字符串数组使字典序最小
- Visual Studio Package 插件开发
- 文章标题
- 关于接口中语言不同,用的方法可以试着换下
- JSON校验工具
- 【恶意代码分析】关键函数备忘录
- c++中内置的 string 类
- Django中文官方版08-创建简单表单
- 如何让外网访问本地服务器
- 计算药量项目中的TabControl控件使用
- BoxLayout布局管理器