zmzimpl
zmzimpl
2017-01-17 15:09

刚学Struts2,访问index.jsp页面正常,访问login.jsp页面就报错

  • struts

我用的是通配符的方式访问,输入
http://localhost:8088/TestStruts/TestStruts_index.action时可以跳转到index.jsp页面,
但输入http://localhost:8088/TestStruts/TestStruts_login.action时,
就报There is no Action mapped for namespace [/] and action name [TestStruts_login] associated with context path [/TestStruts].

struts.xml代码如下:

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"

"http://struts.apache.org/dtds/struts-2.5.dtd">


<constant name="struts.i18n.encoding" value="UTF-8"></constant>

<constant name="struts.action.extension" value="do,action"></constant>

<constant name="struts.serve.static.browserCache" value="false"></constant>

<constant name="struts.configuration.xml.reload" value="true"></constant>

<constant name="struts.devMode" value="true"></constant>

<constant name="struts.enable.DynamicMethodInvocation" value="false"></constant>


<package name="default" namespace="/" extends="struts-default">
    <action name="*_*" method="{2}" class="com.test.action.{1}" >
        <result name="login">/login.jsp</result>
        <result name="index">/{2}.jsp</result>
    </action>


</package>

麻烦大神解惑~

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

5条回答