应用struts(版本号2.3.32)和tomcat(版本7.0.77)搭建一个本地服务器,运行环境是MyEclipse;

首先将下载的tomcat和tstruts两个解压包解压

得到:

搭建服务器(Tomcat,struts)

搭建服务器(Tomcat,struts)

1.配置Tomcat

打开MyEclipse->Window->Preferences

搭建服务器(Tomcat,struts)

将tomcat根目录设置进去。

然后打开server面板就可以看到tomcat了(看不到server可在Window->show view进行查找)

搭建服务器(Tomcat,struts)


2.新建一个Web Project。

搭建服务器(Tomcat,struts)


3.引入struts

找到struts目录下的apps目录

搭建服务器(Tomcat,struts)

找到struts2-blank.war文件进行解压得到

搭建服务器(Tomcat,struts)

进入WEB-INF->libs将所有文件复制到刚建立的Web Project中

搭建服务器(Tomcat,struts)

然后进入WEB-INF->classes中将struts.xml文件复制带Web Project 的src中如下图(可能会有错一会再改。。)

搭建服务器(Tomcat,struts)

struts.xml修改如下(DynamicMethodInvocation设置为true,删除package下信息)

搭建服务器(Tomcat,struts)

进入到WEB-INF目录中将web.xml文件打开

搭建服务器(Tomcat,struts)

将选中的代码复制到Web Project 下WEB-INF下的web.xml中的web-app标签下

搭建服务器(Tomcat,struts)


4.在server面板中Add Deployment

搭建服务器(Tomcat,struts)

将刚才创建的项目导入,然后右键Run Server,观察Console

搭建服务器(Tomcat,struts)

server成功运行起来了,我们就可以编写服务器代码了!



相关文章:

  • 2022-12-23
  • 2021-11-21
  • 2021-04-25
  • 2021-06-26
  • 2022-01-02
  • 2022-01-05
  • 2022-12-23
  • 2021-08-30
猜你喜欢
  • 2021-07-13
  • 2021-08-29
  • 2022-02-11
  • 2022-01-14
相关资源
相似解决方案