
Spring
taoyuanforrest
这个作者很懒,什么都没留下…
展开
-
Jpetstore研究(一):spring MVC + jpetstore + mysql搭建
1> 下载spring MVC自带的jpetstore工程源码http://download.youkuaiyun.com/detail/sundongsdu/5344600 2> 将db\mysql目录里的schema和data导入mysql 3> 修改pom.xml: i) 禁掉 org.apache.struts原创 2013-05-08 21:13:14 · 1605 阅读 · 0 评论 -
Jpetstore研究(二)配置文件分析
1> web.xml 配置log4j: <!-- - Key of the system property that should specify the root directory of this - web app. Applied by WebAppRootListener or Log4jConfigListener. --> webAppRoot原创 2013-05-12 09:11:14 · 1167 阅读 · 0 评论 -
SpringMVC controller控制页面跳转
假设我的应用场景是用户访问http://xxx/admin/redirect.do?link=http://baidu.com,跳转到百度。 注意,跳转到外部页面,页面地址必须以http://开头 @Controller @RequestMapping("/admin/redirect") public class RedirectController ....... 方法1:原创 2013-05-15 10:19:30 · 7920 阅读 · 1 评论 -
Spring MVC提交参数中文乱码
1> 对于POST提交的数据,可以通过spring MVC的过滤器配置实现: 在web.xml中配置 SetCharacterEncoding org.springframework.web.filter.CharacterEncodingFilter encoding utf-8 SetCharacterEncodi原创 2013-05-30 13:23:42 · 2046 阅读 · 0 评论 -
spring MVC session传递model
通过spring MVC提供的@SessionAttributes 可以通过将model存在session实现跨controller的model传递,实现方法: 在存和取的controller类上都要添加注解,例如: @Controller @RequestMapping("/myController/demo1") @SessionAttributes("demoModel") public原创 2013-07-18 23:25:13 · 1852 阅读 · 0 评论 -
spring mvc + ajax 中文乱码
客户端设置: $.ajax({ type: "Get", url: encodeURI(goUrl), dataType: "text", success: function (data) { alert(data); return true; }原创 2013-07-29 20:04:15 · 1522 阅读 · 0 评论 -
spring mvc restful service string/json/xml
Spring MVC可以提供restful service,通过@ResponseBody注解可以返回各种数据类型,比如string/json/xml 配置: <bean id="jsonConverter" class="org.springframework.http.conver原创 2013-07-30 18:33:47 · 2330 阅读 · 0 评论 -
spring mvc + concurrent blockingQueue + @PostConstruct
Spring MVC可以通过@PostConstruct注解来在spring framework启动时带起一些程序运行。 比如应用场景为:应用启动以后希望启动一个blockingQueue,应用启动以后可以向队列中放入待处理对象。 QueueService用于存放队列对象及负责启动消费者线程ConsumerService。ProducerService用于向队列中塞对象,它将由controll原创 2013-07-31 19:26:48 · 1659 阅读 · 0 评论 -
springMVC项目在jboss7中配置应用自己的log4j
Jboss7默认采用容器自己的log4j module,应用自己配置的log4j不起作用,需要应用做一些设置: 以springMVC项目为例: 1> 在WEB-INF下新建文件jboss-deployment-structure.xml,内容如下: 2> 在web.xml里配置 log4jConfigLo原创 2013-07-17 11:19:43 · 3831 阅读 · 1 评论