Struts2的HelloWorld程序
来源:互联网 发布:excel表格数据 编辑:程序博客网 时间:2024/05/16 15:54
第一种方法:不借助IDE,完全手写。
在tomcat的webapps下建立文件夹tutorial
创建如下目录结构和文件:
/tutorial/META-INF/
/tutorial/WEB-INF/
/tutorial/WEB-INF/classes/HelloWorld.java
/tutorial/WEB-INF/classes/struts.xml
/tutorial/WEB-INF/lib/(放struts相关的包)
/tutorial/WEB-INF/web.xml
分别编辑HelloWorld.java,struts.xml,web.xml三个文件
HelloWorld.java
然后需要编译这个类~~ms还得借助IDE才能编译成功~~,class文件也放在同目录下
struts.xml
web.xml
之后启动tomcat,输入URL:http://localhost:8080/tutorial/HelloWorld.action ,成功~~
需要注意的细节:
1.struts.xml文件名不要写错!!其它诸如default等词也有可能写错,会导致莫名其妙的错误
2.运行前编译HelloWorld类
3.struts.xml文件放在classes目录下~
可能会出现的错误: 1.There is no Action mapped for namespace / and action name HelloWorld
第二种方法:Eclispe下创建Web工程,之后导出war包到tomcat的webapps下。这种方法要简单得多
也要注意查看你的struts.xml 文件是否在src目录下;
首先查看你的struts.xml 文件是否在classes目录下; 然后检查有没单词写错的~~
- Struts2的HelloWorld程序
- Struts2的HelloWorld程序
- Struts2的HelloWorld程序
- Struts2之HelloWorld程序
- struts2 一个简单的 struts2程序(HelloWorld)
- struts2的helloworld程序部署报错的解决方案
- 2、Struts2之HelloWorld程序
- Struts2的开篇程序HelloWorld中的两点错误
- struts2的helloworld
- struts2下的helloworld
- struts2的helloworld版
- struts2的HelloWorld
- 搭建struts2的helloworld
- Struts2入门第一个程序HelloWorld
- (2)Struts2的HelloWorld
- struts2 helloworld 的404错误
- Struts2的配置与helloworld
- OpenGL的HelloWorld程序
- Debian下配置APACHE2+MYSQL5+PHP5
- GDI+与GDI屏幕抓图比较
- oasis文件中的数据类型
- 基础代码
- 循环队列操作实现
- Struts2的HelloWorld程序
- test
- makefile变量使用及其条件判断
- 多线程同步之 CriticalSection(临界区)
- 朝觐华为
- 疯狂地学习C语言
- SHENGHUO
- python特色语法归纳
- vista下QQ面板图标打不开问题解决办法