首页 > 其他 > 详细

Struts2 HelloWorld

时间:2016-04-13 09:45:10      阅读:172      评论:0      收藏:0      [点我收藏+]

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

 

 

主要流程:

技术分享

Struts2 HelloWorld

原文:http://www.cnblogs.com/shi-yi-ge/p/5385776.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!