`
gstarwd
  • 浏览: 1536189 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

SSH中Cannot retrieve mapping for action

阅读更多

 

<script type="text/JavaScript"> alimama_pid=&quot;mm_12368347_1712376_6973925&quot;; alimama_titlecolor=&quot;0000FF&quot;; alimama_descolor =&quot;000000&quot;; alimama_bgcolor=&quot;FFFFFF&quot;; alimama_bordercolor=&quot;E6E6E6&quot;; alimama_linkcolor=&quot;008000&quot;; alimama_bottomcolor=&quot;FFFFFF&quot;; alimama_anglesize=&quot;0&quot;; alimama_bgpic=&quot;0&quot;; alimama_icon=&quot;0&quot;; alimama_sizecode=&quot;13&quot;; alimama_width=250; alimama_height=60; alimama_type=2; </script><script src="http://a.alimama.cn/inf.js" type="text/javascript"> </script>
<!-- ecms.*-->

做了一个SSH的例子,在单击用户治理的时候,报了下面的问题
javax.servlet.ServletException: Cannot retrieve mapping for action /#
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.manage.UsersInfo_jsp._jspService(UsersInfo_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
pms.struts.filter.WebFilter.doFilter(WebFilter.java:23)

用户治理的对应action是可以进入的。已经卡了一周了。希望大家可以尽快帮我解决一下。谢谢了!

网友回复:下面是ApplicationContext.xml的内容
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver </value>
</property>
<property name="url">
<value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=myitem; </value>
</property>
<property name="username">
<value>sa </value>
</property>
<property name="password">
<value> </value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="mappingResources">
<list>
<value>pms/struts/dto/Users.hbm.xml </value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect </prop>
<prop key="hibernate.show_sql">true </prop>
</props>
</property>
</bean>
<bean id="userDao" class="pms.struts.dao.UsersDao">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean name="/index" class="pms.struts.action.IndexAction" singleton="false">
<property name="userDao">
<ref local="userDao"/>
</property>
</bean>
<bean name="/usersInfo" class="pms.struts.action.UsersInfoAction" singleton="false">
<property name="name">
<value>demo </value>
</property>
</bean>
<bean name="/menu" class="pms.struts.action.MenuAction" singleton="false">
</bean>
<bean name="/top" class="pms.struts.action.TopAction" singleton="false">
</bean>
<bean name="/login" class="pms.struts.action.LoginAction" singleton="false">
<property name="usersDao">
<ref local="userDao"/>
</property>
</bean>
</beans>


struts-config.xml文件内容
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>
<data-sources />
<form-beans >
<form-bean name="indexForm"
type="pms.struts.form.IndexForm" />
<form-bean name="loginForm"
type="pms.struts.form.LoginForm" />

</form-beans>

<global-exceptions />
<global-forwards />
<action-mappings >
<action path="/index"
name="indexForm"
type="pms.struts.action.IndexAction"
scope="request">
<forward name="index" path="/index.jsp"/>
<forward name="main" path="/main.jsp"/>
</action>

<action attribute="loginForm"
name="loginForm"
path="/login"
scope="request"
type="pms.struts.action.LoginAction" >
<forward name="login" path="/login.jsp" />
<forward name="manageDefault" path="/manage/Default.jsp" />
</action>
<action
path="/menu"
scope="request"
type="pms.struts.action.MenuAction">
<forward name="menu" path="/manage/MenuPage.jsp" />
</action>
<action path="/top" type="pms.struts.action.TopAction">
<forward name="top" path="/manage/top.jsp" />
</action>

<action
path="/usersInfo"
scope="request"
type="pms.struts.action.UsersInfoAction"
validate="false">
<forward name="usersinfo" path="/manage/UsersInfo.jsp" />
</action>

</action-mappings>
<controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor">
</controller>
<message-resources parameter="pms.struts.ApplicationResources" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/classes/applicationContext.xml" />
</plug-in>
</struts-config>

主html页面内容
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title> </title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<link rel="stylesheet" type="text/css" href="../css/common.css">
</head>

<frameset framespacing="0" frameborder="no" border="0" rows="10%,*">
<frame name="topFrame" noresize="noresize" frameborder="yes" src="top.do"/>
<frameset framespacing="0" cols="30%,*" frameborder="no">
<frame name="meanuFrame" frameborder="yes" noresize="noresize" src="menu.do"/>
<frame name="mainFrame" frameborder="no" noresize="noresize" />
</frameset>
</frameset>
<body>
</body>
</html>

用户治理页面的html内容
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*,pms.struts.dto.*" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />

<title>用户信息治理 </title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<link rel="stylesheet" type="text/css" href="css/common.css" >

</head>

<body>
<html:form action="#" method="post" name="usersForm">
<table width="100%">
<tr>
<td>

</td>
</tr>
<tr>
<td name="TdWidth100">
<table width="100%" name="TableBorder">
<tr>
<td name="TdWidth100">
用户治理
</td>
</tr>
</table>
</td>
</tr>
</table>
</html:form>
</body>
</html:html>
网友回复:谢谢大家了!!
网友回复:你action写成 action="#" 那怎么找的到呢
网友回复: <html:form action="#" method="post" name="usersForm"> 改成Action中path对应的路径,如:

<html:form action="/login.do" >



网友回复:谢谢了!!没想到犯了这个低级错误了。

分享到:
评论

相关推荐

    java struts常见错误以及原因分析

    1 异常 javax.servlet.jsp.JspException: Cannot retrieve mapping for action /Login (/Login是你的action名字) 可能原因:action没有再struts-config.xml 中定义,或没有找到匹配的action,例如在JSP文件中使用 ...

    Strus常见错误及原因分析.doc

    当你看到"Cannot retrieve mapping for action /Login"这样的异常时,通常表示Struts无法在`struts-config.xml`配置文件中找到对应的action定义。这可能是由于以下几个原因: - 在`struts-config.xml`中没有定义名...

    ssh框架错误总结

    例如,在struts-config.xml文件中没有配置companyNews的action,引发javax.servlet.ServletException: Cannot retrieve mapping for action /companyNews。 解决方法:在struts-config.xml文件中添加companyNews的...

    struts 常见错误

    当遇到“Cannot retrieve mapping for action /Login”这样的异常时,通常是因为在`struts-config.xml`配置文件中没有正确地定义Action或者找不到与之匹配的Action。确保你的JSP页面中提交的表单URL(如`...

    CentOS系统yum源使用报错:Error: Cannot retrieve repository metadata (repomd.xml) for repository: rpmforge.-附件资源

    CentOS系统yum源使用报错:Error: Cannot retrieve repository metadata (repomd.xml) for repository: rpmforge.-附件资源

    SSH错误集锦

    7. “Cannot retrieve mapping for action XXX” 这个错误通常发生在 .jsp 的标签里指定 action='/XXX' ,但这个 Action 并未在 struts-config.xml 里设置过。解决方法是检查 struts-config.xml 文件,确保 Action ...

    -软件工程第一章作业

    首先,我们来看第一个异常:“javax.servlet.jsp.JspException: Cannot retrieve mapping for action /Login”。这个异常通常意味着在Struts配置文件(struts-config.xml)中没有正确定义或找不到对应的Action。在JSP...

    Struts常见错误及原因分析.

    #### 一、异常 javax.servlet.jsp.JspException: Cannot retrieve mapping for action /Login **异常描述**: 该异常通常出现在尝试访问一个未在`struts-config.xml`文件中正确配置的Action时。具体表现为无法获取...

    Struts的常见错误和异常.doc

    1. **Cannot retrieve mapping for action 异常** 当尝试访问一个未在`struts-config.xml`中定义的Action时,会出现此异常。这可能是因为你在JSP文件中指定了一个不存在的Action,如`&lt;html:form action="Login.do"&gt;...

    Retrieve Form for Data Capture (RFD)

    Retrieve Form for Data Capture (RFD)

    Struts常见错误及原因分析

    1. 异常 javax.servlet.jsp.JspException: Cannot retrieve mapping for action /Login 这个错误表明在struts-config.xml中没有为/L Login定义Action Mapping。确保在配置文件中正确地声明了Action,如: ```xml ...

    【开发经验】Struts常见错误及原因分析 .doc

    1. 异常`javax.servlet.jsp.JspException: Cannot retrieve mapping for action /Login` 这个错误表明在`struts-config.xml`中没有为`/Login`动作定义映射,或者找不到匹配的动作。检查`struts-config.xml`的`...

    报错ORA01804解决方法.txt

    使用PL/SQL登录ORACLE数据 报错,error while trying to retrieve text for error ORA-01804,的解决方法,操作步骤,在windows server 2008R2 64位,oracle 12C,PLSQL Developer 12 64位,以上使用环境正常,

    WEB开发报错处理集锦

    1. Cannot retrieve mapping for action/submitUpdateStuffTimeRecordAction 这是Struts框架中一个常见的错误,错误信息表明无法找到相应的Action mapping。解决方法是检查Struts配置文件中的action mappings,确保...

    SSH架构整合的Dept、Emp的CRUD

    在这个“SSH架构整合的Dept、Emp的CRUD”项目中,我们看到的是对两个核心数据库实体——“Dept”(部门)和“Emp”(员工)进行的创建(Create)、读取(Retrieve)、更新(Update)和删除(Delete)操作的实现。 首先,...

    ssh-crud.rar_SSH CRUD_ssh

    Hibernate是SSH中的持久层框架,它简化了Java对象与数据库之间的映射关系,实现了ORM(Object-Relational Mapping)。Hibernate提供了丰富的API和查询语言(HQL),使得开发者可以方便地进行数据的CRUD操作,无需关注...

    jsp常见异常

    javax.servlet.jsp.JspException: Cannot retrieve mapping for action /Login/LoginAction 这种异常通常发生在使用Struts框架时,当JSP页面尝试访问一个未在`struts-config.xml`中定义的Action时会抛出此异常。...

    Knowledge-driven Encode, Retrieve, Paraphrase for MedicalImageReport.pdf

    We propose a novel Knowledge-driven Encode, Retrieve, Paraphrase (KERP) approach which reconciles traditional knowledge- and retrieval-based methods with modern learning-based methods for accurate ...

    Aspen安装指南.pdf

    Aspen安装教程,如果安装过程中提示licence cannot retrieve,重新安装下install_Sentinel.RMS.8.5.1.Server,安装完成后如果提示不能获取证书,需要把C:\Program Files\Common Files\AspenTech Shared中的STRGXI2....

Global site tag (gtag.js) - Google Analytics