Struts环境的安装与配置

2014-11-24 01:37:12 · 作者: · 浏览: 0

1、打开myeclipse开发环境(我的myeclipse是8.5版本),新建一个web项目(本次所有的过程都会有图),然后window->preferences->Server->Tomcat->Tomcat6.0,然后选中Enable,并且找到你所装的tomcat的目录。点击ok

2、点击window->preference->java->Installed Jres->然后add你的jdk位置,(我的是D:\java)->finish

3、拷贝struts的配置文件struts.xml到新建的项目src中,该文件在:http://pan.baidu.com/s/1qWPPaig 百度网盘

4、struts环境安装所需的jar文件(类库):http://pan.baidu.com/s/1zTeYq 百度网盘

5、将WebRoot->WEB-INF下面的web.xml中的代码全部替换为 :

  

  
  
    
    
     index.jsp
     
   
  
  
    
    
     struts2
     
    
     org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
     
   

    
    
    
     struts2
     
    
     /*
     
   

  

这里需要将index.jsp 更名为Hello.jsp(,因为刚刚上面的struts.xml 中是Hello.jsp)


然后在浏览器中输入:http://localhost:8888/Struts2_0100_Introduction/hello.action(因为在struts.xml中有一个namespace=”/“)

输出解果是:

\


================中间过程的几个步骤截图如下:===============< http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+PGltZyBzcmM9"https://www.cppentry.com/upload_files/article/76/1_fjttt__.jpg" alt="\">