最近看一个Spring,MVC,Hibanate的框架,里面的表单属性action不知道为什么
action="../docGroupManage/show.action">
路径最后面有一个.action,而我以前写的SSM框架里直接就是路径,不加.action我想知道这是可有可无的还是有特定效果的
,我比较理解差,最好通俗点
不加也是可以的,.action是struts2中出现的.do是sturts1办的
这个就是在web。xml里面配置的,作用就是好区分请求和页面路径,只有符合后缀的请求才会被接受。这个和struts2不关事
没记错的话,,,这个是可以设置的,,设置 访问后缀,, .action,,是struts的习惯。
struts设置:
<!-- value是后缀,可以指定任何后缀 -->
<constant name="struts.action.extension" value="html"></constant>
<!-- value为空时可以不加后缀 -->
<constant name="struts.action.extension" value=""></constant>
<!-- value可以设置为 action -->
<constant name="struts.action.extension" value="action"></constant>
比如,我要是写一个路径,后面加action和不加action没有什么区别么?而且你好666啊,我看好多问题的回答栏里都有你
这是web.xml中的访问的过滤设置,如果我配置一个servlet:
dispatcher
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath*:spring-mvc.xml
1
dispatcher
/*.action
url-pattern 就是过滤方式 ,检查路径中 有*.action格式的, 将这个路径拦截 进入到dispatcher这个配置的servlet中去.
是你web.xml配置的问题。所有的请求先去web.xml配置的那个地方,然后才去你的controller,我整理了一些初学springmvc的博客,当然内容网上都有。楼主可以看看!!