idea创建struts2项目目显示“HTTP Status 404 ”

解决struts配置 报http status 404 错误的方案 - CSDN博客
解决struts配置 报http status 404 错误的方案
当感觉自己基本没写错,无从下手的时候,先查看下导入的包是否完整,一般需要以下几个jar包:
commons-fileupload-x.y.z.jar
commons-io-x.y.z.jar
commons-logging-x.y.jar
freemarker-x.y.z.jar
ognl-x.y.z.jar
struts2-core-x.y.z.jar
xwork-x.y.z.jar
确认完发现该有的都有,那接下来需要做的是检查路径是否写对了,还有struts.xml配置文件应当WEB-INF/classes文件夹下,以及放在还有action里的class要完整的名字,就是连同包名也应该包括进来像这样:
packageName.className
不完整的报名也会报出这个错误,不过这个错误在console可以看到这个错误提示:
Dispatcher initialization failed
如果以上都搞定了,还是报错,不要灰心,还有一个解决方案,如果console显示的是以下错误信息:
严重: Exception starting filter
struts2java.lang.NullPointerException
看看代码中是否有段:
&constant name="struts.devMode" value="true"/&
这里devMode模式是开发模式,开启它则默认开启了i18n.reload,configuration.xml.reload。这个错误是由于configuration.xml.reload设置为true造成的。换句话说就是你的tomcat安装目录中有空格导致了这个错误,比如常见的:Program Files,这中间就有个空格,这样是不行的,改过来就好。另外,不能直接修改文件名来改,这样你的tomcat会崩,还是重新安装一个吧。
本文已收录于以下专栏:
相关文章推荐
作为一个Java新人工作的一些总结和笔记,有什么不对的欢迎批评指导。
本博文系列参考自&第三版,作者:王爽
Dubug是dos,windows下提供的调试工具,使用该工具,可以查看和修改寄存器,内存的内容。同时可以在机器码级别跟踪程序源码的运行。
1.常用的de...
启动DEBUG程序,DEBUG程序用于调试可执行文件。
  格式:
  DEBUG[[drive:][path]filename[testfile-parameters]]
转自:/blog/1396637
认识debug视图,红色部分框为线程堆栈视图,黄色部分框为表达式、断点、变量视图,蓝色部分为代码视图...
最近在学习jsp和servlet,避免不了的要和tomcat打交道,但tomcat经常会出现各式各样的错误,下面是我总结的一些常见的解决方法,希望对大家有用。
1.未部署Web应用
没有任何程序员能够一气呵成的写出没有任何 Bug 的代码,所以很多程序员有相当一部分时间是花费在 Debug 上的,程序调试是每个程序员必须面对的工作。如何使用 Eclipse 进行有效的、尤其是高效...
这个是更加全面的HTTP请求错误状态码大全链接地址:http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html,下面只是常出现的部分。
debug最基本的知识
F5-Step Into:移动到下一步,如果当前的行是一个方法调用,将进入这个方法的第一行。(可以通过第九条来排除)F6-Step Over:移动到下一行。如果当前行有方法...
web页面报404的错误: 说明这个页面不存在。
    导致的原因有:
                ...
HTTP Status 404 - /Struts2_HelloWorld/HelloWorldtype Status reportmessage /Struts2_HelloWorld/HelloW...
他的最新文章
讲师:宋宝华
讲师:何宇健
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)Struts2.0报错HTTP Status 404 - /Struts2_HelloWorld/HelloWorld - CSDN博客
Struts2.0报错HTTP Status 404 - /Struts2_HelloWorld/HelloWorld
HTTP Status 404 - /Struts2_HelloWorld/HelloWorld
type Status report
message /Struts2_HelloWorld/HelloWorld
description The requested resource (/Struts2_HelloWorld/HelloWorld) is not available.
Apache Tomcat/6.0.13
***********************************************************************************************
开发环境:
JDK:jdk1.5.0_11
Tomcat:apache-tomcat-6.0.13
Eclipse Platform:Version: 3.3.0 Build id: I0&
Struts:struts-2.0.9
***********************************************************************************************
&?xml version=&1.0& encoding=&UTF-8&?&&web-app id=&WebApp_9& version=&2.4& xmlns=&& xmlns:xsi=&& xsi:schemaLocation=& &&
&&& &display-name&Struts Blank&/display-name&
&&& &filter&&&&&&&& &filter-name&struts2&/filter-name&&&&&&&& &filter-class&org.apache.struts2.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-list&
&/web-app&
***********************************************************************************************
struts.xml
&!DOCTYPE struts PUBLIC&&&&&&& &-//Apache Software Foundation//DTD Struts Configuration 2.0//EN&&&&&&&& &&&&struts&&&include file=&struts-default.xml& /&&&package name=&tutorial& extends=&struts-default&&&&&action name=&HelloWorld& class=&tutorial.HelloWorld&&&&&&result&HelloWorld.jsp&/result&&&&/action&&&/package&&/struts&
***********************************************************************************************
SayHello.jsp
&%@ page language=&java& contentType=&text/ charset=ISO-8859-1&&pageEncoding=&ISO-8859-1&%&&%@ taglib prefix=&s& uri=&/struts-tags&%&&!DOCTYPE html PUBLIC &-//W3C//DTD HTML 4.01 Transitional//EN& &&&&html&&head&&meta http-equiv=&Content-Type& content=&text/ charset=ISO-8859-1&&&title&Say Hello&/title&&/head&&body&&h3&Say &Hello& to:&/h3&&s:form action=&HelloWorld&&&&&&&&&&&&& Name: &s:textfield name=&name& /&&&s:submit /&&/s:form&
&/body&&/html&
***********************************************************************************************
HelloWorld.jsp
&%@ page language=&java& contentType=&text/ charset=ISO-8859-1&&pageEncoding=&ISO-8859-1&%&&%@ taglib prefix=&s& uri=&/struts-tags&%&&!DOCTYPE html PUBLIC &-//W3C//DTD HTML 4.01 Transitional//EN& &&&&html&&head&&meta http-equiv=&Content-Type& content=&text/ charset=ISO-8859-1&&&title&Hello&/title&&/head&&body&&h3&&s:property value=&name& /&&/h3&&/body&&/html&
***********************************************************************************************
HelloWorld.java
import com.opensymphony.xwork2.ActionS
public class HelloWorld extends ActionSupport {&private static final long serialVersionUID = 1L;
&private S
&public String getName() {&&&}
&public void setName(String name) {&&this.name =&}
&public String execute() {&&name = &Hello, & + name + &!&;&&return SUCCESS;&}}***********************************************************************************************
运行,就会报HTTP Status 404 - /Struts2_HelloWorld/HelloWorld的错误。
从可以看到:
HTTP Status 500 -
type Exception report
description The server encountered an internal error () that prevented it from fulfilling this request.
There is no Action mapped for namespace / and action name HelloWorld. - [unknown location]
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.
***********************************************************************************************
解决:struts.xml文件名错误,改正后可以看到
Hello, null!
本文已收录于以下专栏:
相关文章推荐
找不到action,让我头痛了一上午的问题呀哭
HTTP Status 404 - /Struts2/hello.action
1.struts2的下载
http://archi...
Struts2之Action
1、action与servlet
  在struts1中 一个Action类完全等同于一个servlet类,但在struts2中,你也可以把它看作是一个servle...
在Server Options里,选择Publish module contexts to separate XML files。如果不选一般会报错。
这一步的主要目的在于 :
错误:Server Tomcat v7.0 Server at localhost failed to start.如图:
解决办法:
1、In Eclipse, Open the
&Server&...
/quxuedan/archive//2813445.html
网上有关这题的解答很多,比如:
PermGen space的全称是Permanent Generation space,是指内存的永久保存区域OutOfMemoryError: PermGen space从表面上看就是内存益出,解决...
PermGen space的全称是Permanent Generation space,是指内存的永久保存区域OutOfMemoryError: PermGen space从表面上看就是内存益出,解决...
/blog/2249750
手把手Maven搭建SpringMVC+Spring+MyBatis框架(超级详细版)
他的最新文章
讲师:宋宝华
讲师:何宇健
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)2013年10月 Java大版内专家分月排行榜第二2013年3月 Java大版内专家分月排行榜第二2013年2月 Java大版内专家分月排行榜第二
2013年7月 Java大版内专家分月排行榜第三2013年5月 Java大版内专家分月排行榜第三2013年4月 Java大版内专家分月排行榜第三
2013年10月 Java大版内专家分月排行榜第二2013年3月 Java大版内专家分月排行榜第二2013年2月 Java大版内专家分月排行榜第二
2013年7月 Java大版内专家分月排行榜第三2013年5月 Java大版内专家分月排行榜第三2013年4月 Java大版内专家分月排行榜第三
2013年3月 总版技术专家分月排行榜第二
2014年2月 Java大版内专家分月排行榜第一2013年8月 Java大版内专家分月排行榜第一2013年5月 Java大版内专家分月排行榜第一2013年4月 Java大版内专家分月排行榜第一2013年3月 Java大版内专家分月排行榜第一2013年2月 Java大版内专家分月排行榜第一
本帖子已过去太久远了,不再提供回复功能。

我要回帖

更多关于 怎么创建struts.xml 的文章

 

随机推荐