当前位置:编程学习 > JAVA >>

struts 2 中遇到一个问题message There is no Action mapped for namespace [/] and action n

刚刚自学struts 2 遇到这个问题,希望大家帮帮忙,谢谢大家!
struts

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>

<constant name="struts.locale" value="zh_CN" ></constant>
<constant name="struts.devMode" value="true" ></constant>
<constant name="struts.il8n.encoding" value="gb2312" />

<package name="default" namespace="/" extends="struts-default">
<action name="hwAction" class="cn.action.hwAction">
<result name="toWelcome">/welcome.jsp</result>
</action>

</package>


</struts>
login.jsp
<form action="hwAction.action" method="post">
姓名:<input type="text" name="account"><br>

密码:<input type="password" name="password"><br>
<input type="submit" value="提交">
--------------------编程问答-------------------- 能贴一下错误信息吗?
--------------------编程问答-------------------- namespace="/" 没有存在的意义,可以省略,既然想使用命名空间就跟他去个名namespace="/test",调用时是“/test/你的action名称” --------------------编程问答-------------------- 试试修改这个
<form action="/hwAction.action" method="post"> --------------------编程问答-------------------- 试试修改这个
<form action="/hwAction.action" method="post">

报错:type Status report

message /hwAction.action

description The requested resource is not available.
--------------------编程问答-------------------- 其他的方法都试了还是差不多一样的错误!
麻烦大家了!谢谢大家。 --------------------编程问答-------------------- 你 的加上项目的相对路径!
<%
String path = request.getContextPath();
%>
<%=path %>/hwAction.action

试试!
--------------------编程问答-------------------- 你也没说这是什么错误啊  把错误说出来就好解决了
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,