Struts 2 URL错误

时间:2010-02-03 12:16:36

标签: struts2 struts2-namespace

这是我的struts config file: 我项目的根目录是 StrutsProject

<?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="false" />
 <package name="first" namespace="/helloworld" extends="struts-default">
  <action name="HelloWorld" class="com.abc.actions.HelloWorldAction">
   <result name="SUCCESS">/pages/login.jsp</result>
  </action>
 </package>
</struts>

我正在尝试访问以下网址: http://localhost:8080/StrutsProject/helloworld/HelloWorld.action

我收到以下错误:

There is no Action mapped for action name helloworld. - [unknown location]
 at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
 at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
 at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:497)
 at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)

请帮忙, 亚洲时报Siddharth

1 个答案:

答案 0 :(得分:1)

您的JSP文件位置是否正确?

/pages/login.jsp

或者它应该是

/WEB-INF/pages/login.jsp