
spring mvc
文章平均质量分 66
spring mvc
sunhuwh
求学阶段
展开
-
唯一登录
框架: spring+springMVC 唯一登录情况分为两种:一个客户端允许用户登录一次;多个客户端只允许用户登录一次一个客户端允许用户登录一次 模型设计:Token { userId, client, code}模型解释,一个客户端,一个用户,只会有一个code(标识) 每次登录的时候,都会重新设置一个code,code保存入库,并且保存进session中。 利用拦截器,每原创 2017-11-21 19:50:25 · 2493 阅读 · 0 评论 -
json乱码
@ResponseBody注解的json乱码,解决:原创 2014-10-20 23:50:48 · 528 阅读 · 0 评论 -
welcome-file-list不起作用
web.xml中welcome-file-list不起作用,报405原创 2014-11-05 22:42:45 · 7007 阅读 · 5 评论 -
springMVC因表单参数不匹配报错
这里有三个:一:原创 2014-10-04 22:00:33 · 2602 阅读 · 0 评论 -
注解拦截
import java.lang.annotation.ElementType;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;import java.lang.annotation.Retention; @Target(ElementType.METHOD)@Ret原创 2014-11-14 23:43:32 · 1052 阅读 · 2 评论 -
通过@Value注解读取.properties配置内容 (续)
今天发现了一个问题:下面是通过@Value注解读取.properties配置内容原创 2014-10-02 22:31:36 · 743 阅读 · 0 评论 -
注意
Hibernate条件查询时注意别将个别的原创 2014-11-10 23:01:35 · 411 阅读 · 0 评论 -
通过@Value注解读取.properties配置内容
@Controller@RequestMapping("/value")public class ValuePropertyController extends ApplicationController{ @Value("#{configProperties['jdbc.jdbcUrl']}") private String jdbcUrl; @RequestMappi原创 2014-08-31 00:12:03 · 46137 阅读 · 2 评论 -
利用包装类传json数据
/** * 利用包装类传json数据 * @param page * @param request * @return */ @RequestMapping("/json") @ResponseBody public HashMap json(@RequestParam(value = "page", required =原创 2014-08-22 00:08:43 · 1976 阅读 · 0 评论 -
SpringMVC的几种返回方式
package com.boventech.learning.controller;import java.util.HashMap;import java.util.Map;import org.springframework.stereotype.Controller;import org.springframework.ui.Model;import org.springfra原创 2014-12-04 23:04:32 · 167129 阅读 · 13 评论 -
检索方法
写一个实体,专门用来简单的关键词检索package com.boventech.zyk.util;/** * 简单的关键词检索辅助类 (参数都可以为空) * page 页码,pageSize 分页大小, limit 最大结果数, queryName 检索列,queryWord 检索关键词, orderColumn 排序列,orderType 排序类型 */public clas原创 2015-01-18 23:24:06 · 738 阅读 · 0 评论 -
<form:errors>使用注意
表单验证方法:利用springmvc的表单验证来做;首先需要在存的时候要将元素给验证一下:需要注意的是:需要给验证的对象加上@Valid,标识。需要有一个对象存错误信息:BindingResult result(然后如果是save方法,就需要给个重定向RedirectAttributes ra)@RequestMapping(method = POST) pub原创 2015-01-21 00:00:25 · 16362 阅读 · 0 评论 -
redis:spring-data-redis
首先需要安装redis: 下载地址:https://github.com/MSOpenTech/redis/releases完成后,开始写代码: 使用注解的方式进行配置@Configuration@EnableWebMvc@ComponentScan(basePackages = {"xx.redis"})@PropertySource({"classpath:jedis.properti原创 2016-11-22 11:52:40 · 490 阅读 · 0 评论 -
spring mvc 过滤器-HiddenHttpMethodFilter 表单method标准化
浏览器form表单只支持GET与POST请求,而DELETE、PUT等method并不支持,spring3.0添加了一个过滤器,可以将这些请求转换为标准的http方法,使得支持GET、POST、PUT与DELETE请求,该过滤器为HiddenHttpMethodFilter。 HiddenHttpMethodFilter的父类是OncePerRequestFilter,它继承了父原创 2014-05-04 20:17:27 · 1073 阅读 · 0 评论 -
controller
controller层不要将两个有紧密联系的save,update,delete放在一起,我们要考虑到如果controller层中这些个操作是否执行成功。而不成功的话会带来严重后果。 所以我们要将这些操作放在service层进行包装。然后用@Transational进行注解。这样就可以回滚原创 2015-07-22 23:08:56 · 646 阅读 · 0 评论 -
springMVC注解
简略思维导图原创 2016-06-23 20:42:44 · 958 阅读 · 0 评论 -
springmvc支持带参数跳转
实例: 表单提交,提交有问题,返回原有数据,表单将原有数据填上。 使用RedirectAttributes原创 2016-02-06 08:51:00 · 1347 阅读 · 0 评论 -
springmvc上传临时文件目录配置
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="uploadTempDir" value = "/upload"></property> <!-- <prope原创 2015-09-09 22:04:20 · 7540 阅读 · 0 评论 -
jsp自建tag标签
Insert title here ${user.name}<% UserService service = (UserService)SpringUtil.getObject("userService"); User user = service.findById(id); request.setAttribute(userModel, user);%>原创 2015-04-06 00:05:07 · 703 阅读 · 0 评论 -
spring获取properties信息
class前面注解:@Configuration @PropertySources({ @PropertySource("classpath:config.properties"), @PropertySource("classpath:database.properties") }) spring推荐使用env来获取:@Autowired原创 2015-03-15 23:32:57 · 765 阅读 · 0 评论 -
springmvc梳理9-----用注解来进行数据绑定
与前面一章有着异曲同工之处,只不过注解显得原创 2014-06-19 16:04:23 · 730 阅读 · 0 评论 -
springmvc梳理9----数据绑定
之前的blog中也提到过获取参数的一些方法:原创 2014-06-19 01:54:03 · 917 阅读 · 0 评论 -
springmvc梳理8----Content-Type
@Controller@RequestMapping("/requestContentType")public class RequestContentTypeController { @RequestMapping(value = "/ContentType", method = RequestMethod.GET) public String showForm()原创 2014-06-18 02:08:10 · 9737 阅读 · 0 评论 -
@Servlet配置错误导致view层无法获取关联对象
因为过滤的时候进入的是OpenEntityManagerInViewFilter filterChain.doFilter(request, response);原创 2014-05-13 02:13:55 · 937 阅读 · 0 评论 -
Spring配置 <context:component-scan/> <mvc:annotation-driven />
标签。这个标签的原创 2014-05-11 23:36:56 · 9054 阅读 · 1 评论 -
spring mvc annotation总结
他的作用是式地向 Spring 容器注册AutowiredAnnotationBeanPostProcessor、CommonAnnotationBeanPostProcessor、PersistenceAnnotationBeanPostProcessor 以及 RequiredAnnotationBeanPostProcessor 这 4 个BeanPostProcessor。原创 2013-08-15 23:55:51 · 1252 阅读 · 0 评论 -
spring mvc
SimpleFormContoller 提供了显示从 HTTP GET 请求接收到的表单的功能,以及处理从 HTTP POST 接收到的相同表单数据的功能。原创 2013-08-15 00:01:58 · 783 阅读 · 0 评论 -
RequestMethod
spring3.0添加了一个过滤器,可以将这些请求转换为标准的http方法,使得支持GET、POST、PUT与DELETE请求配置:filter> filter-name>HiddenHttpMethodFilterfilter-name> filter-class>org.springframework.web.filter.HiddenHttpMethodFilterf原创 2013-08-27 08:59:59 · 20448 阅读 · 4 评论 -
springmvc项目注意事项
构建springmvc项目需要注意的地方:要提供springmvc annotation,不然根本就不能够访问Controller类了。默认:mvc:annotation-driven />他的作用是式地向 Spring 容器注册AutowiredAnnotationBeanPostProcessor、CommonAnnotationBeanPostProcessor、Pe原创 2013-08-23 09:01:14 · 2154 阅读 · 0 评论 -
springmvc annotation 2
Springmvc annotation:@PathVariable是用来对指定请求的URL路径里面的变量 eg: Java代码 @RequestMapping(value = "form/{id}/apply", method = {RequestMethod.PUT, RequestMethod.POST}) {id}在这个请求的URL里就是个变量,可以使用@PathVariable来获取原创 2013-08-23 09:00:08 · 699 阅读 · 0 评论 -
a href带参数传递
@RequestMapping(value = "/{id}",params = {"courseId"},method = RequestMethod.DELETE)原创 2014-05-14 20:05:16 · 33845 阅读 · 1 评论 -
Springmvc PropertyEditor实现绑定时的类型转换
public class DataBinderTestModel{ private String username; private boolean bool;//Boolean值测试 private PhoneNumberModel phoneNumber;//String->自定义对象的转换测试 private Date date;//日期类型测试 public String原创 2014-06-04 01:31:42 · 4205 阅读 · 0 评论 -
ajax+springmvc实现C与View之间的数据交流
jQuery.post(url, [data], [callback], [type])url,[data],[callback],[type]String,Map,Function,StringV1.0url:发送请求地址。data:待发送 Key/value 参数。callback:发送成功时回调函数。type:返回内容格式,xml, html, script,原创 2014-05-23 00:44:42 · 1168 阅读 · 0 评论 -
springmvc梳理7---注解控制器
例子:/** * @author hu.sun * *@Controller:用于标识是处理器类; *@RequestMapping:请求到处理器功能方法的映射规则; * *@Contoller和@RequestMapping注解支持类:处理器映射RequestMappingHandlerMapping *和处理器适配器RequestMappingHandlerAdapter组合原创 2014-06-17 01:54:24 · 1243 阅读 · 0 评论 -
springmvc梳理6-----springmvc拦截器(2)
public class HandlerInterceptor1 extends HandlerInterceptorAdapter {//此处一般继承HandlerInterceptorAdapter适配器即可 /** * 在preHandle中,可以进行编码、安全控制等处理; * 在postHandle中,有机会修改ModelAndView; * 在afterCompleti原创 2014-06-16 02:26:55 · 955 阅读 · 0 评论 -
springmvc梳理6-----springmvc拦截器
在处理器之前或者之后进行处理原创 2014-06-15 05:03:05 · 926 阅读 · 0 评论 -
springmvc梳理5 Controller
原来以前对MVC里面的C都理解错误。原创 2014-06-13 01:26:37 · 608 阅读 · 0 评论 -
springmvc梳理3 DispatcherServlet
contextLoadListener和原创 2014-06-13 01:27:12 · 729 阅读 · 0 评论 -
梳理springmvc
首先用户发送请求————>前端控制器,前端控制器根据请求信息(如URL)来决定选择哪一个页面控制器进行处理并把请求委托给它原创 2014-06-12 02:15:50 · 703 阅读 · 0 评论 -
springmvc梳理2
/** * @Contoller和@RequestMapping注解支持类:处理器映射RequestMappingHandlerMapping 和 处理器适配器 * RequestMappingHandlerAdapter组合来代替Spring2.5开始的处理器映射 * HttpMessageConverter进行请求内容区数据到@RequestBody注解的命令对象的转换,Spring会根原创 2014-06-12 02:17:19 · 611 阅读 · 0 评论