【发布时间】:2012-01-24 17:50:55
【问题描述】:
我是 Struts2 的绝对初学者。我正在关注 struts 网站上的教程。我关注了this tutorial。我有一些麻烦。我在 Eclipse 上创建了动态 Web 项目。然后我按照教程。但是,当我运行示例时,出现以下错误。
There is no Action mapped for namespace [/] and action name [hello] associated with context path [/Hello_World_Struts_2]. - [unknown location]
我有以下目录结构
而我的 struts.xml 文件是
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="basicstruts2" extends="struts-default" namespace="/">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="org.apache.struts.helloworld.action.HelloWorldAction" method="execute">
<result name="SUCCESS">/HelloWorld.jsp</result>
</action>
</package>
</struts>
感谢您的回复。
【问题讨论】:
-
我试图把它放在代码块中,但我做不到。现在,没关系,我想。
标签: struts2 struts2-namespace action-mapping