码迷,mamicode.com
首页 > 其他好文 > 详细

简单搭建一个helloword程序

时间:2017-04-18 14:30:20      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:success   创建   cut   com   坚持   method   项目   关联   解压缩   

序言:

  人生最大的遗憾不是失败,而是我本可以!挣扎了好久,决定开始做一些事,从简单入手,坚持下去,希望以后某一天回头还能看到一步一个脚印中的我!

  

搭建helloword程序

  1.http://struts.apache.org/ 下载struts-2.3.32-all.zip;

  2.创建web project程序,导入struts-2.3.32-all.zip中的struts2-blank.war解压缩lib中的jar包;

  3.web.xml文件配置过滤器

   <filter>
     <filter-name>struts2</filter-name>
     <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

  4.导入struts.xml配置文件:

   * 需要关联http://struts.apache.org/dtds/struts-2.3.dtd配置文件才会有提示

   * package(namespace)、action(class,method)、result(name,type)默认值

   <struts>
     <package name="helloworld" extends="struts-default" namespace="/">
        <action name="login" class="com.opensymphony.xwork2.ActionSupport" method="execute">
           <result name="success" type="dispatcher">/WEB-INF/login.jsp</result>
        </action>
     </package>
  </struts>

  5.启动tomcat加载该项目;

  6.访问浏览器:http://localhost:8080/项目名/login

简单搭建一个helloword程序

标签:success   创建   cut   com   坚持   method   项目   关联   解压缩   

原文地址:http://www.cnblogs.com/sunxm1/p/6727194.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!