There is no Action mapped for namespace [/]

使用struts2框架产生的问题:

index.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<jsp:forward page="/login/login.jsp"></jsp:forward>

login.jsp:

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<script type="text/javascript">
function ini(){
   document.form1.loginName.focus();
}
</script>
<html>
    <head>
        <meta http-equiv="Content-Language" content="zh-cn">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link href="${pageContext.request.contextPath}/css/Style.css" rel="stylesheet" type="text/css">
    </head>
    <body >
        <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td align="center">
                    <table width="452" height="290" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td bgcolor="#FFFFFF">
                                <table width="452" height="290" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td height="74">
                                            <img src="${pageContext.request.contextPath}/images/logintitle.gif">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" valign="bottom" background="${pageContext.request.contextPath}/images/loginbg.gif">
                                            <s:form id="form1" name="form1"  action="LoginAction_home.do" target="_parent" method="post">    
                                                <table border="0" align="center" cellpadding="2" cellspacing="0">
                                                    <tr align="center">
                                                        <td height="30" colspan="2" style="border-bottom: 1px dotted #cccccc">
                                                            <strong style="font-size: 14px;">请登录</strong>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td height="30" nowrap>
                                                            <font color="000F60"><strong>用户名:</strong> </font>
                                                        </td>
                                                        <td>
                                                            <s:textfield name="loginName" id="loginName" class="text" style="width: 160px;"/>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td height="30" nowrap>
                                                            <strong><font color="000F60">密码: </font> </strong>
                                                        </td>
                                                        <td>
                                                            <s:password name="loginPsw" id="loginPsw"  class="text" style="width: 160px;"/>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td height="30" nowrap colspan="2">
                                                            <strong><s:fielderror/><font color="red"></font> </strong>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td height="30">
                                                        </td>
                                                        <td>
                                                            <s:submit type="button" name="submit" value="登录" class="buttoninput"></s:submit>
                                                            <s:reset type="button" name="reset" value="取消" class="buttoninput"></s:reset>
                                                        </td>
                                                    </tr>
                                                </table>
                                                </s:form>
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td height="30" align="center">
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td height="23" align="center"></td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </body>
</html>

这里所填写的form表单 namespace="/login"action=" LoginAction_home.do",会造成的问题是:

  • There is no Action mapped for namespace [/] and action name
    [LoginAction_home] associated with context path [/itcast1109_project].

原因是因为".do",

解决办法:方法一:把".do"去掉。

方法二:把namespace去掉,action改为"/login/LoginAction_home.do"

时间: 2024-11-03 20:27:25

There is no Action mapped for namespace [/]的相关文章

There is no Action mapped for namespace [/user] and action name [user!add] associated with context p

使用struts2.3进行动态方法调用时出现: There is no Action mapped for namespace [/user] and action name [user!add] associated with context path错误,原因是 (1)DMI可能导致安全问题 (2)DMI与通配符方法功能有重叠,因此该版本Struts2默认关闭DMI,需要在struts.xml中加一句 <constant name="struts.enable.DynamicMetho

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [product-save] associated with context path [/20161101-struts2-2].

运行:index.jsp---->input.jsp----->details.jsp,但是在input.jsp到details.jsp的时候报错误. 异常如下: 严重: Could not find action or result/There is no Action mapped for namespace [/] and action name [] associated with context path []. - [unknown location]at com.opensymp

关于Struts2中的错误:例如There is no Action mapped for namespace / and action name product-input.

            在配置struts.xml 文件时,会出现    There is no Action mapped for namespace / and action name ....    意思是没有product-input的映射文件或者是命名空间       出现这样的错误的原因后:     做如下检查:           1: 把struts.xml中的namespace="/"改成namespace=""或者去除,使用默认的命名空间. 2:

There is no Action mapped for namespace / and action name 通配符的问题

之前看了一些struts2的视频. 现在复习了下 struts2.发现了这个问题 网上的说的解决办法大都没提到这个问题,1%的文章提到了新版本的struts中 method的问题 There is no Action mapped for namespace / and action name XXX http://localhost:8080/Struts2Learn/loginAction_login.action 原因不详. 解决办法: 通配符  *  的使用方法中. struts-2.5

There is no Action mapped for namespace [/] and action name [Login] associated with context path [/e

近期学习web开发时,就遇到这个令人头疼的问题. 百度谷歌了N遍,最终在博客http://blog.csdn.net/liu578182160/article/details/17266879中找到了问题的根源. 开发环境:win7 32位旗舰版,jdk1.7_45,jre7,eclipse4.3.1 JavaEE版,tomcat 7.0.42,struts2.3.16.3 问题出如今web.xml配置 原web.xml: <?xml version="1.0" encoding

struts2中错误There is no Action mapped for namespace [/] and action name [] associated with context path

1 There is no Action mapped for namespace [/] and action name [] associated with context path [/Struts2_0300_Action2]. - [unknown location] 2 at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) 3 at org.apache.struts2.i

struts2 : There is no Action mapped for namespace / and action name

2015.07.13 晚 学习搭建SSI 框架,用到struts2 ,启动后访问指定login.action报错 There is no Action mapped for namespace / and action name 查找原因,struts.xml 没有被找到. 解决方法 1 : 在web.xml中指定struts.xml 的位置 解决方法 2 : 将struts.xml 放在src根目录下,web.xml中不需配置struts.xml的地址. 总结 ,对框架各配置文件之间作用不了解

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [Action!Method]错误解决

按照书本上的Struts2的例子,运行会出现错误: HTTP Status 404 - There is no Action mapped for namespace [/] and action name [sayHelloAction!sayStruts2] ... 貌似在struts.xml中配置action的method不会出错,而直接在jsp中写“Action!Method.action”就会报错. 搜索许久没有发现解决办法,后来发现第二种写法叫做“DMI”,会产生安全隐患,在stru

There is no Action mapped for namespace [/] and action name [LoginAction_home] associ

使用struts2框架产生的问题: index.jsp: <%@ page language="java" contentType="text/html; charset=UTF-8"%> <jsp:forward page="/login/login.jsp"></jsp:forward> login.jsp: <%@ page language="java" pageEncodin

There is no Action mapped for namespace [/] and action name [xx] associated with context path...

好久没用Struts了,今天练了一个简单的应用,出现了一些意外的问题,由于这种原因一直报404 首先我的目录结构是这样子滴 web.xml中是这样配置的 <web-app> <display-name>Archetype Created Web Application</display-name> <filter> <filter-name>struts2</filter-name> <filter-class>org.a