刚开始学的struts2 看的马士兵的视频。
按着视频里的敲的 可是第一个程序就报了 404 错误
按着视频里的敲的 可是第一个程序就报了 404 错误
解决方案 »
- spring+hibernate整合配置问题
- 找个错
- SSH的表连接的查询,怎么做啊??????很急很急啊!
- Hibernate处理统计信息
- 老问题,Hibernate连接池,在网上没找到对口的解决方案,在此求救
- 紧急求助!!!!
- hibernate+spring+struts validator问题
- jjava如何读取windows 事件日志 (.evtx) 文件? [问题点数:100分]
- 一个困惑很久的问题,能回答该问题的必定是高手中的高手!!
- Jboss发布遇到问题 “数据库中已经存在名为×××的对象”
- hibernate 上面的问题
- 用servlet实现登录进入欢迎界面的一个问题,希望高手给看看谢谢了
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter> <filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>这是web.xml
<!-- Add packages here -->
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<action name="hello">
<result>
/index.jsp
</result>
</action>
</package></struts>
这是 struts.xml
Apache Tomcat/6.0.26这是错误页
<result> //这里没有指定 name ,,
/index.jsp
</result>
</action>
在xml的action中少了class属性,如class="package_name.action_name"
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
试试着个过滤的写法
马士兵的是已经配好的TOMCAT.
参照这个方法:
http://blog.csdn.net/wqjsir/article/details/7169838
要怎么写?
现在问题确定了。
tomcat启动就出问题了
严重: Error filterStart
2013-3-17 14:38:23 org.apache.catalina.core.StandardContext start
严重: Context [/lllll] startup failed due to previous errors
2013-3-17 14:38:24 org.apache.catalina.core.StandardContext start
2013-3-17 19:53:58 org.apache.catalina.core.StandardContext startInternal
严重: Context [/Struts2_0100_Introduction] startup failed due to previous errors2013-3-17 19:53:58 org.apache.catalina.loader.WebappClassLoader checkThreadLocal
MapForLeaks
严重: The web application [/Struts2_0100_Introduction] created a ThreadLocal wit
h key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.open
symphony.xwork2.inject.ContainerImpl$10@1fb3211]) and a value of type [java.lang
.Object[]] (value [[Ljava.lang.Object;@940b84]) but failed to remove it when the
web application was stopped. Threads are going to be renewed over time to try a
nd avoid a probable memory leak.
2013-3-17 19:53:58 org.apache.catalina.loader.WebappClassLoader checkThreadLocal
MapForLeaks
严重: The web application [/Struts2_0100_Introduction] created a ThreadLocal wit
h key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.open
symphony.xwork2.inject.ContainerImpl$10@18041e0]) and a value of type [java.lang
.Object[]] (value [[Ljava.lang.Object;@16504fa]) but failed to remove it when th
e web application was stopped. Threads are going to be renewed over time to try
and avoid a probable memory leak.
现在大概总结到这个问题
求大神啊!!!!
最头痛的时还找不到错。
我是按着视频敲的 结果还不对。把我弄的无从下手了。 网上找解决方法。都试过了 也不行啊
[email protected]
另外struts2我记得有一点很怪异的就是明明配置好了。但是有时候就是提示找不到对应的返回值,但是struts.xml文件是没有问题的。。clean工程,清空缓存都没有,重启下电脑之后竟然就好了。。
简单的话你发一下web.xml和struts.xml就可以了
我猜你是图方便不想重复配置struts,就直接copy人家的或以前的项目到自己的机子上就直接运行了,其实这时运行的还是之前的那个项目名,这样当然找不到。初学者必犯错误
右击项目名--->properties----->myEclipse----->找到web contextroot,改成你要运行的项目名,就是你当前的项目名。
如果不是,那就是struts配置错了
我用别的方式 倒是成功了 不知道为什么这个按视频敲的就是不行。 项目名也没问题。
不过我把那个项目的web.xml 改回没写之前的就不报404错误了
访问路径中的项目路径、action后缀,.do.action试下就好了。
还是不行,就按标准配置写个action 吧。
<result>
/index.jsp
</result>
</action>
class属性都没写,不报错就不正常了,找到你action类的路径:报名.类名
如: <action name="hello" class="com.ssh.XXXXAction">
<result>
/index.jsp
</result>
</action>
正解!这里指定name="success"或其它…………