这是我的jsp页面
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>welcome</title>
</head>
<body> <s:form action="init" method="post">
<s:textfield name="username" label="用户名"></s:textfield>
<s:textfield name="password" label="密码"></s:textfield>
<s:textfield name="caption" label="书名"></s:textfield>
<s:textfield name="content" label="内容"></s:textfield>
<s:submit value="提交"></s:submit>
</s:form>
</body>
</html>这是我的Struts.xml
<struts> <package name="init" extends="struts-default">
<action name="init" class="com.cts.elt.SubmitAction">
<result name="success">/form.jsp</result> </action>
</package>
</struts>这是我的Action
public String execute() throws Exception {
InfoService infoservice = new InfoServiceImpl();
info.setCaption(caption);
info.setContent(content);
info.setPassword(password);
info.setUserName(userName); infoservice.addInfo(info);
return SUCCESS;
}我在地址栏里打了http://localhost:8080/StrutsHibernate.form.jsp,跳出了JSP页面。但是输入信息点了提交。
报错404:message There is no Action mapped for namespace [/] and action name [init] associated with context path [/StrutsHibernate].description The requested resource (There is no Action mapped for namespace [/] and action name [init] associated with context path [/StrutsHibernate].) is not available.明明Action名字什么都匹配了,为何还这样说?求大神指教菜鸟