程序很简单新建动态网页工程Struts2_HelloWorld
将Struts2.16中的lib文件考到WebContent/lib下,新建index.html;struts.xml;web.xml
index.html在WebContent下;struts.xml在src下;web.xml在WEB-INF下
web.xml内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Struts2_HelloWorld</display-name>
<filter>
<filter-name>Struts2</filter-name>
<filter-class>org.apache.struts.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>Struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
sttruts.xml内容如下:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="struts-default.xml"/>
</struts>
最后导出war到webapp下!
http://localhost:8080/Struts2_HelloWorld/
结果如下:
HTTP Status 404 -type Status reportmessagedescription The requested resource () is not available.
Apache Tomcat/6.0.18请哪位大虾帮忙解决一下,不胜感激!!!!!!!!!!!!!!!!!
将Struts2.16中的lib文件考到WebContent/lib下,新建index.html;struts.xml;web.xml
index.html在WebContent下;struts.xml在src下;web.xml在WEB-INF下
web.xml内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Struts2_HelloWorld</display-name>
<filter>
<filter-name>Struts2</filter-name>
<filter-class>org.apache.struts.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>Struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
sttruts.xml内容如下:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="struts-default.xml"/>
</struts>
最后导出war到webapp下!
http://localhost:8080/Struts2_HelloWorld/
结果如下:
HTTP Status 404 -type Status reportmessagedescription The requested resource () is not available.
Apache Tomcat/6.0.18请哪位大虾帮忙解决一下,不胜感激!!!!!!!!!!!!!!!!!
解决方案 »
- tomcat自动死掉
- s2sh问题
- cvc-complex-type.3.2.2: Attribute 'transation-manager' is not allowed to appear
- 关于JCreator新建项目的问题呵呵呵
- 计数器问题
- 请解释一下下面一段的含义
- 关于springmvc+ibatis使用poi导出Excel的问题
- jsp2.0的疑惑
- 100分!!我要把ASP+ACCESS网站转成JSP+SQL的,细节问题:有没有整站(整个目录)转换的程序,或者关键问题:ACCESS怎么转成SQL
- 在jsp中怎样打印从数据库中读出显示在表格中的数据?
- Tiles:有时页面只加载部分
- 防止CLASS文件被下载
导包的时候注意不要把所有的包都导进去,不然就会出现Unable to load configuration. - bean - jar:file:/d:/Tomcat6/webapps/EJBBookStoreWebModule/WEB-INF/lib/struts2-convention-plugin-2.1.6.jar!/struts-plugin.xml:30:119
此类的错误,这应该是struts2.1.6的一个bug吧~~~HelloWorld.jsp<%@ taglib prefix="s" uri="/struts-tags" %><html>
<head>
<title>Hello World!</title>
</head>
<body>
<h2><s:property value="message" /></h2>
</body>
</html>*****************web.xml<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"><welcome-file-list>
<welcome-file>HelloWorld.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>com.mycompany.myapp.actions</param-value>
</init-param>
</filter> <filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
******************
*****************struts.xml<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="tutorial" extends="struts-default">
<action name="HelloWorld" class="tutorial.HelloWorld">
<result>/HelloWorld.jsp</result>
</action>
<!-- Add your actions here -->
</package>
</struts>*******************************************