整合ssh2时出现 404 - There is no Action mapped for namespace / and action name login.

rasracter 2011-11-22 10:14:50
错误
HTTP Status 404 - There is no Action mapped for namespace / and action name login.

--------------------------------------------------------------------------------

type Status report

message There is no Action mapped for namespace / and action name login.

description The requested resource (There is no Action mapped for namespace / and action name login.) is not available.


web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

</web-app>




struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<package name="common" extends="struts-default">
<action name="login" class="userAction" method="login">
<result name="success">/success.jsp</result>
<result name="input">/error.jsp</result>
</action>
</package>
</struts>



applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://127.0.0.1:3306/teaching_affair</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>root</value>
</property>
</bean>

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"
ref="dataSource">
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true
hibernate.format_sql=false
</value>
</property>
<property name="mappingResources">
<list>
<value>bean/Userinfo.hbm.xml</value>
</list>
</property>
</bean>

<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="userDao" class="com.sshtest.dao.UserDaoImple">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="userService" class="com.sshtest.service.UserServiceImple">
<property name="userDao" ref="userDao"/>
</bean>

<bean id="userAction" class="com.sshtest.action.UserAction">
<property name="userService" ref="userService"/>
</bean>
</beans>



index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</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">
-->
</head>

<body>
<form action="login.action" method="post"><table>
<tr><td>username:</td><td><input type="text" name="user.username"/></td></tr>
<tr><td>password:</td><td><input type="password" name="user.password"/></td></tr>
<tr><td><input type="submit" value="login"/></td></tr>
</table></form>
</body>
</html>
...全文
736 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
rasracter 2011-11-28
  • 打赏
  • 举报
回复
解决了,在爱问下的struts-spring-plugin是坏包,谢谢yulongde77同志了
rasracter 2011-11-22
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 yulongde77 的回复:]
大哥,你是不是用的STRUTS2啊,如果是怎么不支持STRUTS标签了,还有你的index.jsp中根本没引用STRUTS2标签
[/Quote]

用了struts2标签按你的改了后又404了
海逸_2018 2011-11-22
  • 打赏
  • 举报
回复
大哥,你是不是用的STRUTS2啊,如果是怎么不支持STRUTS标签了,还有你的index.jsp中根本没引用STRUTS2标签
rasracter 2011-11-22
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 yulongde77 的回复:]
你看下我一个项目里的:struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<package name="b……
[/Quote]




我这边struts.xml里没有设置namespace, 右边的outline里自动有一个common的包,里面有login的action

我的index.jsp如果用s:form就会又提醒unknown tag s:form,而且不支持namespace属性。
海逸_2018 2011-11-22
  • 打赏
  • 举报
回复
你看下我一个项目里的:struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<package name="bmAdjust" namespace="/bmAdjust" extends="ecp-default">

<action name="listBmAdjust" method ="listBmAdjust" class="com.zjdxsoft.action.BmAdjustDetailsAction">
<result>/page/adjust/adjusts.jsp</result>
</action>
<action name="toEditAdjust" method ="toEditAdjust" class="com.zjdxsoft.action.BmAdjustDetailsAction">
<result>/page/adjust/editAdjusts.jsp</result>
</action>
<action name="toAddAdjust" method ="toEditAdjust" class="com.zjdxsoft.action.BmAdjustDetailsAction">
<result>/page/adjust/addAdjusts.jsp</result>
</action>
<action name="addBmAdjust" method ="addBmAdjust" class="com.zjdxsoft.action.BmAdjustDetailsAction">
<result>/success.jsp</result>
<result name="error">/Error.jsp</result>
</action>
<action name="EditAdjust" method ="EditAdjust" class="com.zjdxsoft.action.BmAdjustDetailsAction">
<result>/success.jsp</result>
<result name="error">/Error.jsp</result>
</action>
</package>
</struts>
jsp:
<!--列表页面-->
<s:form action="listBmAdjust" id="myForm1" namespace="/bmAdjust">
<table cellpadding="0" cellspacing="0" class="list_table">
<tr>
<th class="list_th">
<img src="<%=request.getContextPath()%>/images/list_icon.gif" align="absmiddle" style="padding-left:15px;" /><strong>计费矫正管理</strong>
</th>
</tr>
</table>
<input type="hidden" name="offset" value="<s:property value="offset"/>">
<input type="hidden" name="length" value="<s:property value="length"/>">
<input type="hidden" name="funCode" value="<s:property value="funCode"/>"/>
<table cellpadding="0" cellspacing="0" class="list_content1" width="98%">
<tr>
<td width="10%" height="33" class="conten_td1">矫正编码:</td>
<td width="20%" height="33" class="conten_td2"><s:textfield name="bmAdjustDetailsBean.adjustId" cssClass="textfrom" cssStyle="width:120" />
</td>
<td width="10%" height="33" class="conten_td1">矫正科目:</td>
<td width="20%" height="33" class="conten_td2"><s:textfield name="bmAdjustDetailsBean.itemName" cssClass="textfrom" cssStyle="width:120" /></td>
</td>
</tr>
<tr>
<td width="10%" height="33" class="conten_td1">矫正费率:</td>
<td width="20%" height="33" class="conten_td2"><s:textfield name="bmAdjustDetailsBean.rateName" cssClass="textfrom" cssStyle="width:120" /></td>
</tr>
<tr>
<td colspan="4" height="33" class="conten_td3" style = "text-align:center;"><input type="submit" style="margin: 5px;" onmouseover="this.style.background='url(<%=path%>/images/list_btnon.gif)'" onmouseout="this.style.background='url(<%=path%>/images/list_btn.gif)'" name="Submit" class="button_normal" value="查 询"></td>
</tr>
</table>
</s:form>
参考下
rasracter 2011-11-22
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 gavin_ts 的回复:]
struts.xml中
<package name="common" extends="struts-default">
换成
<package name="common" namespace="/" extends="struts-default">
[/Quote]

试过了,不行。
rasracter 2011-11-22
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 yulongde77 的回复:]
你的JSP页面form提交时中也要加:namespace="/common"
[/Quote]
没有404错误了,也没有跳转到指定页面,页面是一片空白
我嘞个去 2011-11-22
  • 打赏
  • 举报
回复
struts.xml中
<package name="common" extends="struts-default">
换成
<package name="common" namespace="/" extends="struts-default">
海逸_2018 2011-11-22
  • 打赏
  • 举报
回复
你的JSP页面form提交时中也要加:namespace="/common"
rasracter 2011-11-22
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 yulongde77 的回复:]
struts.xml中
<package name="common" extends="struts-default">
换成
<package name="common" namespace="/common" extends="struts-default">
加个命名空间试试
[/Quote]

还是不行,不过错误提示是
There is no Action mapped for namespace /

不是"/common",虽然我已经改了。
海逸_2018 2011-11-22
  • 打赏
  • 举报
回复
struts.xml中
<package name="common" extends="struts-default">
换成
<package name="common" namespace="/common" extends="struts-default">
加个命名空间试试
内容概要:本文提出了一种促进可再生能源发电消纳的用户侧典型资源需求响应策略,并通过Matlab代码实现进行仿真验证。该策略聚焦于通过优化用户侧用电行为来提升电网对可再生能源波动性的适应能力,重点研究了需求响应机制下典型负荷资源的建模与调度方法。通过对用户侧可调节负荷(如温控负荷、电动汽车等)的特性分析,建立标准化的需求响应模型,结合电价激励或直接控制手段,引导用户在可再生能源出力高峰段增加用电,在低谷段减少用电,从而实现削峰填谷、提升新能源消纳水平的目标。研究还深入探讨了与共享储能系统的协同优化机制,进一步增强系统的灵活性和调节能力,为高比例可再生能源接入背景下的源网荷储协调运行提供技术支撑。; 适合人群:具备一定电力系统基础知识,从事新能源、需求响应、综合能源系统、电力市场等相关领域研究的科研人员及研究生。; 使用场景及目标:① 学习和复现用户侧需求响应在促进新能源消纳中的应用;② 掌握典型可调节负荷的精细化建模方法及其在Matlab中的程序实现;③ 为研究源网荷储协同优化、电力市场机制设计、综合能源系统调度等前沿课题提供可扩展的技术参考和代码基础。; 阅读建议:此资源包含完整的Matlab代码实现,建议读者在学习理论模型的同,务必动手运行和调试代码,结合仿真结果深入理解需求响应策略的作用机理、优化过程及与共享储能协同的增益效果。
内容概要:本文围绕一个供应链产能分析项目的面试技术问题展开,深入探讨了LangGraph的状态机机制、工具调用原理、业务逻辑实现、流式传输、记忆管理、并发安全及系统优化方向。重点解析了State共享机制、reducer的作用、条件路由与循环控制、@tool装饰器自动生成Schema的原理,以及主子Agent分层设计带来的工具调用清晰性。同指出了当前实现中存在的风险点,如共享状态导致的并发问题、明文配置安全隐患、模拟流式而非真正token流等,并提出了改进思路,包括引入锁机制、异步无状态架构、密钥管理服务和长期记忆RAG设计。此外还涉及测试缺失与性能瓶颈(如网关延迟、上下文膨胀)的应对策略。; 适合人群:具备一定Python与FastAPI开发经验,熟悉LangChain/LangGraph框架,正在准备AI工程化或供应链智能化相关岗位面试的中高级研发人员(工作2-5年)。; 使用场景及目标:①深入理解LangGraph在复杂业务场景中的状态流转与多Agent协作机制;②掌握工具调用、流式响应、记忆管理和安全性设计的最佳实践与常见陷阱;③在面试中展现对系统边界、稳定性、可扩展性的深度思考,提升技术表达的专业度与说服力。; 阅读建议:此资料适用于面试前冲刺复盘,建议结合“面试准备_精华版”对照学习,重点关注问题背后的架构权衡与改进方案,不仅能“背答案”,更要能“讲设计”。

81,111

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧