struts2开发流程

    使用struts2不难,大体就分为如下几步:web

    1)在web.xml中定义struts2的核心拦截器,这与SpringMVC很类似,SpringMVC经过spring

    org.springframework.web.servlet.DispatcherServlet拦截,而struts2则经过apache

    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter进行拦截。它不单对*.action页面进行拦截,若须要已post方式提交请求,则需对相应的*.jsp页面进行拦截。jsp

    2)定义处理数据的Action(继承ActionSupport)重写execute方法便可;post

    3)配置Action处理返回数据与物理试图对应关系,一般使用struts.xml进行配置,<action name="" class=""><result name="input">test.jsp</result></action>spa

    4)编写视图xml

相关文章
相关标签/搜索