- 浏览: 606464 次
- 性别:
- 来自: 杭州
文章分类
- 全部博客 (228)
- io (15)
- cluster (16)
- linux (7)
- js (23)
- bizarrerie (46)
- groovy (1)
- thread (1)
- jsp (8)
- static (4)
- cache (3)
- protocol (2)
- ruby (11)
- hibernate (6)
- svn (1)
- python (8)
- spring (19)
- gma (1)
- architecture (4)
- search (15)
- db (3)
- ibatis (1)
- html5 (1)
- iptables (1)
- server (5)
- nginx (4)
- scala (1)
- DNS (1)
- jPlayer (1)
- Subversion 版本控制 (1)
- velocity (1)
- html (1)
- ppt poi (1)
- java (1)
- bizarrerie spring security (1)
最新评论
-
koreajapan03:
楼主啊,好人啊,帮我解决了问题,谢谢
自定义过滤器时,不能再使用<sec:authorize url="">问题 -
snailprince:
请问有同一页面,多个上传实例的例子吗
webuploader用java实现上传 -
wutao8818:
姚小呵 写道如何接收server返回的参数呢?例如你返回的是“ ...
webuploader用java实现上传 -
姚小呵:
如何接收server返回的参数呢?例如你返回的是“1”,上传的 ...
webuploader用java实现上传 -
zycjf2009:
你好,我想用jplayer做一个简单的播放器,但是因为对js不 ...
jplayer 实战
这里也提到这个问题
http://forum.springsource.org/showthread.php?p=151750
Allow ControllerClassNameHandlerMapping and @Controller to work together
似乎在Spring mvc 2.5.4里面有一个 bug
就是当你实现一个controller 时候,使用 COC原则自动映射。无法映射到对应的默认方法 handleRequestInternal
这个问题在 spring 官方论坛的mvc版块里面也提到了这个问题。还是 appfuse Matt Raible 提交的。
具体的一个解决方式是 Keith Donald 提出的。看看他的配置文件就知道了。
Matt Raible 看了以后说
Thanks Keith - your webmvc-config.xml seems to contain the magic sauce that makes this work as expected.
Keith Donald added a comment - 14/Apr/08 12:27 PM
In Matt's example the index method on HomeController would be mapped to the URL /home/index by the 2.5.3 convention, which I imagine isn't what he wants.
Just to provide more usage examples of this feature, here is an example in the Spring MVC + Web Flow reference application "booking-mvc". You can see the code on-line here: https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc
Specifically see:
@Controller code: https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/HotelsController.java
Config:
https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webmvc-config.xml
The URls mapped by convention are then:
/hotels/index
/hotels/search
/hotels/show
/hotels/deleteBooking
But no, /hotels doesn't mapped to to the index method by default... not in 2.5.3 anyway. Is this the convention you want? Perhaps we could employ a convention to map the root controller URL e.g. /home to a "home" method on the HomeController...
提交到JIRA链接在这里
http://jira.springframework.org/browse/SPR-4129
下面2个spring mvc 相关的链接可以看看
http://blog.springsource.com/2007/11/14/annotated-web-mvc-controllers-in-spring-25/
http://code.google.com/p/nestorurquiza/wiki/SpringMVCTutorial
http://forum.springsource.org/showthread.php?p=151750
Allow ControllerClassNameHandlerMapping and @Controller to work together
似乎在Spring mvc 2.5.4里面有一个 bug
就是当你实现一个controller 时候,使用 COC原则自动映射。无法映射到对应的默认方法 handleRequestInternal
这个问题在 spring 官方论坛的mvc版块里面也提到了这个问题。还是 appfuse Matt Raible 提交的。
具体的一个解决方式是 Keith Donald 提出的。看看他的配置文件就知道了。
Matt Raible 看了以后说
Thanks Keith - your webmvc-config.xml seems to contain the magic sauce that makes this work as expected.
引用
Keith Donald added a comment - 14/Apr/08 12:27 PM
In Matt's example the index method on HomeController would be mapped to the URL /home/index by the 2.5.3 convention, which I imagine isn't what he wants.
Just to provide more usage examples of this feature, here is an example in the Spring MVC + Web Flow reference application "booking-mvc". You can see the code on-line here: https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc
Specifically see:
@Controller code: https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/HotelsController.java
Config:
https://springframework.svn.sourceforge.net/svnroot/springframework/spring-webflow/trunk/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/config/webmvc-config.xml
The URls mapped by convention are then:
/hotels/index
/hotels/search
/hotels/show
/hotels/deleteBooking
But no, /hotels doesn't mapped to to the index method by default... not in 2.5.3 anyway. Is this the convention you want? Perhaps we could employ a convention to map the root controller URL e.g. /home to a "home" method on the HomeController...
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <!-- Maps request paths to flows in the flowRegistry; e.g. a path of /hotels/booking looks for a flow with id "hotels/booking" --> <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> <property name="order" value="0" /> <property name="flowRegistry" ref="flowRegistry" /> </bean> <!-- Maps request paths to @Controller classes; e.g. a path of /hotels looks for a controller named HotelsController --> <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"> <property name="order" value="1" /> <property name="defaultHandler"> <!-- If no @Controller match, map path to a view to render; e.g. the "/intro" path would map to the view named "intro" --> <bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" /> </property> </bean> <!-- Resolves logical view names returned by Controllers to Tiles; a view name to resolve is treated as the name of a tiles definition --> <bean id="tilesViewResolver" class="org.springframework.js.ajax.AjaxUrlBasedViewResolver"> <property name="viewClass" value="org.springframework.webflow.mvc.view.FlowAjaxTilesView"/> </bean> <!-- Configures the Tiles layout system --> <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"> <property name="definitions"> <list> <value>/WEB-INF/layouts/layouts.xml</value> <value>/WEB-INF/views.xml</value> <value>/WEB-INF/hotels/views.xml</value> <value>/WEB-INF/hotels/booking/views.xml</value> </list> </property> </bean> <!-- Dispatches requests mapped to POJO @Controllers implementations --> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> <!-- Dispatches requests mapped to org.springframework.web.servlet.mvc.Controller implementations --> <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" /> <!-- Dispatches requests mapped to flows to FlowHandler implementations --> <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter"> <property name="flowExecutor" ref="flowExecutor"/> </bean> <!-- Custom FlowHandler for the hotel booking flow --> <bean name="hotels/booking" class="org.springframework.webflow.samples.booking.BookingFlowHandler" /> </beans>
提交到JIRA链接在这里
http://jira.springframework.org/browse/SPR-4129
下面2个spring mvc 相关的链接可以看看
http://blog.springsource.com/2007/11/14/annotated-web-mvc-controllers-in-spring-25/
http://code.google.com/p/nestorurquiza/wiki/SpringMVCTutorial
发表评论
-
webuploader用java实现上传
2014-10-17 23:55 40720<div id="uploader&q ... -
springmvc,Servlet3异步,websocket
2014-10-17 22:58 1371spring4.0以后加入了对websocket技术的支持 ... -
SpringMVC中的文件上传【转发】
2014-09-19 21:54 987http://blog.csdn.net/jadyer/art ... -
{转}spring security 3 自定义认证授权示例
2011-11-10 16:46 2267转:http://www.4ucode.com/Study/T ... -
用spring resource 接口获取 web应用的ROOT目录
2010-12-09 19:44 3118Resource r = new ClassPathResou ... -
springmvc 表单 @RequestMapping 上传文件
2010-06-04 18:08 6510@RequestMapping(method = Req ... -
spring MessageSource
2009-06-12 13:06 1249http://www.blogjava.net/xzclog/ ... -
PagedListHolder
2009-03-26 23:32 1643org.springframework.beans.suppo ... -
HOWTO: Use Freemarker, SiteMesh, and Spring MVC(2)
2009-03-19 23:52 2010Here's an example of the Freema ... -
HOWTO: Use Freemarker, SiteMesh, and Spring MVC(1)
2009-03-19 23:50 4759<object classid="c ... -
spring mvc & freemarker 版ROR
2008-06-19 01:27 3527实现COC原则无配置自动映射 引用http://localho ... -
spring mvc 也能实现 ror 类似的URL路由
2008-06-18 18:54 3547看过ror的朋友一定知道它所体现的一个核心思想就是惯例优先原则 ... -
重头开始学 Spring JPetStore 5
2008-06-18 18:25 2011重头开始学 Spring JPetStore 4 里面的Con ... -
重头开始学 Spring JPetStore 4
2008-06-18 15:42 2426跟踪一个 .do 请求吧 就它了。 Enter the S ... -
重头开始学 Spring JPetStore 3
2008-06-18 14:21 2282按 重头开始学 Spring JPetStore 2 中的提示 ... -
重头开始学 Spring JPetStore 2
2008-06-17 11:50 17332. BUILD AND DEPLOYMENT 编译和发布 ... -
重头开始学 Spring JPetStore 1
2008-06-17 11:35 1617先看看它的readme.txt 引用@author Juer ... -
一个关于Spring的好消息及Spring Batch概述
2008-05-26 00:45 56543年前,即将大学毕业,遇到了spring,还以SSH框架为题做 ...
相关推荐
NULL 博文链接:https://bijian1013.iteye.com/blog/2064702
Spring注解 @Component、@Repository、@Service、@Controller区别,有兴趣的可能看一下。
Spring注解@Component、@Repository、@Service、@Controller区别.doc
(1)如果只是使用@RestController 注解 Controller 层,那么 Controller 层中的方法无法返回 (2)如 果 需 要 返 回
主要介绍了@Controller、@RestController注解区别详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
controller注解
弹簧 @Controller @RequestMapping @RequestParam,模型和ModelAndView Spring MVC实践
CAS 3.5.x 系列的基于模块化 SpringMVC @Controller 的 CAS REST 端点实现 该项目是作为 Unicon一部分开发的。 提供此模块的专业支持/集成协助。 欲了解更多信息,。 动机 当前用于 CAS 3.5.x 系列的基于 Restlet ...
2.@RestController注解,相当于@Controller+@ResponseBody两个注解的结合,返回json数据不需要在方法前面加@ResponseBody注解了,但使用@RestController这个注解,就不能返回jsp,html页面,视图解析器无法解析jsp,...
SpringMVC不能只使用@Controller而不使用@RequestMapping
凡带有@Component,@Controller,@Service,@Repository 标志的等于告诉Spring这类将自动产生对象,而@Resource则等于XML配置中的ref,告诉spring此处需要注入对象,所以用@Resource就有了ref的功效。 要用注解注入方式...
@Controller @RequestMapping("/order") public class OrderController { … @RequestMapping(value="/showOrderDetails") public ModelAndView showOrderDetails(HttpSession session,String orderId){ 按照订单号...
假定两个Controller都在同一个工程中。 如果有比较合理的分层设计,这样的需求应该是非常罕见的。因为大部分情况下,调用应该都是限于对业务逻辑层或者数据库层,并不会涉及Controller之间的调用。 本文是讨论...
spring4.0重要的一个新的改进是@RestController注解,它继承自@Controller注解。4.0之前的版本,Spring MVC的组件都使用@Controller来标识当前类是一个控制器servlet。 使用这个特性,我们可以开发REST服务的时候不...
在这份文档中,我们深入探讨了Spring的核心注解,包括但不限于@Component、@Repository、@Service、@Controller和@Autowired。这些注解简化了配置过程,减少了样板代码,并使得组件之间的耦合度降低,更有利于单元...
常用注解:@Controller @RestController(Controller+ResponseBody) @Service @Transactional @Mapper @AutoWired @RequestMapping--路由 @RequestParam--参数绑定(不同名参数或Map<Object,String>) @...
整理笔记:在springboot中的各个注解的作用,包含@Controller、@ResponseBody、@RestController、@RequestMapping、@GetMapping 注解、@SpringBootTest注解:、@RequestParam注解、@Param注解、@pathVariable注解
使用DWR框架技术,使在JavaScript中可以直接访问Java代码,是我们的交互性更好
搭建SpringMVC模型,包含控制层(@Controller)、 业务逻辑层Service(@Service)、持久层(@Repository)三层注入方式。
基于注解的spring mvc,dao 层注解:@Repository("userDao"), entity层注解:@Entity,service层注解:@Service("userService"), action层注解:@Controller("userController") @RequestMapping("/user.do")