Struts2 HelloWorld

1. VS 自实现

1) 搭建Struts2 的开发环境

2) 不需要显式的定义Filter, 而使用的是struts2 的配置文件

3) details.jsp 变得简单了

    ${requestScope.product.productId}-->${productId}

4) 步骤

  ① 由product-input.action 转到/WEB-INF/pages/input.jsp

           在struts2 中配置一个action

        <action name="product-input">
            <result>/WEB-INF/pages/input.jsp</result>
        </action>

  ② 由input.jsp 页面的 "product-save.action"  显示页面的details

        <action name="product-save" class="strutshelloworld.Product"
           method="save">
           <result name="details">/WEB-INF/pages/details.jsp</result>
        </action>

  在Product 中定义个save 方法,且返回值为details

 

 

主要流程:

posted on 2016-04-13 09:33  我表情悠哉  阅读(219)  评论(0编辑  收藏  举报

导航