首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Spring3大URL路径解析器(附工程源代码)

2012-11-03 
Spring三大URL路径解析器(附工程源代码)Spring有三个方法名称解析器(MethodNameResolver):(1)ParameterMet

Spring三大URL路径解析器(附工程源代码)

Spring有三个方法名称解析器(MethodNameResolver):


(1)ParameterMethodNameResolver

(2)InternalPathMethodNameResolver

(3)PropertiesMethodNameResolver

关于三个的使用方法,不必多说,网上可以搜到很多,这里只是简单的提下

ParameterMethodNameResolver在给定的路径后会有一个指定调用哪个方法的参数跟随

例如:http://localhost:9999/method/parameterMethodNameResolver?funcflg=getDate

getDate就是要调用的方法

InternalPathMethodNameResolver方法名包含在路径中

http://localhost:9999/method/internalPathMethodController/getDate

getDate就是要调用的方法

PropertiesMethodNameResolver 调用的方法写在=后面


http://localhost:9999/method/propertiesMethodController/suibian=getDate

getDate就是要调用的方法


相关的XML配置:

web.xml


Spring的配置文件:

mvc.xml

parameterMethod.xml


?

最后工程的访问路径为



ParameterMethodNameResolver ?http://localhost:9999/method/parameterMethodNameResolver?funcflg=getDate

InternalPathMethodNameResolver ?http://localhost:9999/method/internalPathMethodController/getDate

PropertiesMethodNameResolver ?http://localhost:9999/method/propertiesMethodController/suibian=getDate



工程源代码见附件





?

热点排行