There is no Action mapped for namespace [/pages/action/student] and action name [findStudent]

Posted phlsheji

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了There is no Action mapped for namespace [/pages/action/student] and action name [findStudent]相关的知识,希望对你有一定的参考价值。

1、错误描写叙述

2014-7-13 2:38:54 org.apache.jasper.compiler.TldLocationsCache tldScanJar
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2014-7-13 2:38:55 org.apache.struts2.dispatcher.Dispatcher warn
警告: Could not find action or result: /FirstSSH/pages/action/student/findStudent.action
There is no Action mapped for namespace [/pages/action/student] and action name [findStudent] associated with context path [/FirstSSH]. - [unknown location]
	at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
	at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
	at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
	at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
	at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:552)
	at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

2、错误原因

      无法找到Action路径,页面引入Action的路径有问题


3、解决的方法

     在页面引入一个路径jsp

<%@ include file="pathTags.jsp"%> 

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>  
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>  
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>  
<%@ taglib prefix="m" uri="http://java.sun.com/jsp/jstl/functions" %>  
<%  
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%>  
  
<c:set var="bp" value="<%=basePath%>"></c:set>  
<c:set var="pa" value="<%=path%>"></c:set> 

   action请求时

$(function(){
	           $.ajax({
	               type:"post",
	               url:"${bp}/action/student/findStudent.action",
	               dataType:"json",
	               success:function(data){
	                   
	               }
	           });
		});

     路径前加上“${bp}”


以上是关于There is no Action mapped for namespace [/pages/action/student] and action name [findStudent]的主要内容,如果未能解决你的问题,请参考以下文章

Struts2-tomcat报错:There is no Action mapped for namespace / and action

There is no Action mapped for namespace [/] and action name [Login] associated

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [product-save] associa

Struts2中There is no Action mapped for namespace错误解决方法

Struts2中There is no Action mapped for namespace错误解决方法

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