编写接口,别写接口的实现类,接着写action的代码,jsp里面的提交form里面的action怎么写具体看

 

jsp页面里面的action要写struts.xml里面的action名字。

struts.xml里面的每个action里面的class="loginAction"这里的loginAction不再是以前的真正的类的映射!

因为要交给spring管理,所以这里的loginAction 必须 要与 applicationContext.xml 中的

<bean >

的 这里和以前的struts1.x整合spring的时候不一样,因为strust1.x对action的管理是单例模式。

 

配置web.xml的时候

<listener>
 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

它为服务器添加了一个监听器,这样也使的struts2 与 spring 结合起来。如果没有这句话,服务器是启动不了的。

相关文章:

  • 2021-09-11
  • 2021-05-27
  • 2021-12-09
  • 2022-12-23
  • 2021-07-08
  • 2021-08-27
猜你喜欢
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2021-08-20
  • 2021-06-09
相关资源
相似解决方案