SSH,


1:得到相关的jar 添加到web工程的 WEB-INF/lib 中
2:修改xml文件 添加struts的支持
 <!-- struts配置 -->
 <servlet>
  <servlet-name>action</servlet-name>
  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  <init-param>
   <param-name>config</param-name>
   <param-value>/WEB-INF/struts-config.xml</param-value>
  </init-param>
  <load-on-startup>2</load-on-startup>
 </servlet>
 
 <servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
 </servlet-mapping> 
 
 
3: 在web.xml文件中 添加springframework 的应用程序的监听器


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

-------------------------------------------------------------------------------
4:把相关的上下文参数的配置文件  该文件记录springframework的 配置文件的位置

 <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>
   classpath:applicationContext-service.xml,
   classpath:applicationContext-dao.xml
  </param-value>
 </context-param>

--------------------------------------------------------------------------------


5: 在struts 的struts-config.xml 添加插件配置

 <!-- spring 支持struts 的插件 -->
 <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
  <set-property property="contextConfigLocation" value="/WEB-INF/actionContext.xml" />
 </plug-in>


6: 我们的action 的类型必须是 type="org.springframework.web.struts.DelegatingActionProxy" 


7: 配置actionContext.xml文件 在该文件中配置相关的action类
     容易出问题的场合在 <bean id> <bean name> 的混淆

相关内容

    暂无相关文章