【发布时间】:2016-07-06 07:25:07
【问题描述】:
希望有人能提示在哪里寻找问题的根源。
班级登录操作
enter code here
@Namespace("/")
public class LoginAction extends ActionSupport {
private static final long serialVersionUID = 1L;
@Override
@Action(value = "/welcome", results = { @Result(name = SUCCESS, location = "/WEB-INF/content/welcome.jsp") })
When I exectute my index.jsp to execute welcome.jsp didn't work.
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Login Page</title>
</head>
<body>
<h3>Welcome to Struts 2</h3>
<s:form action="home">
<s:textfield name="username" label="User Name"></s:textfield>
<s:textfield name="password" label="Password" type="password"> </s:textfield>
<s:submit value="Login"></s:submit>
</s:form>
</body>
</html>
welcome.jsp
enter code here
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=IUTF-8">
<title>Welcome To Struts 2</title>
</head>
<body>
<h3>
Welcome
<s:property value="username"></s:property>
!
</h3>
</body>
结果 Struts 问题报告
Struts 检测到一个未处理的异常:
消息:
There is no Action mapped for namespace [/] and action name [home] associated with context path [/struts].
【问题讨论】:
-
通过编辑问题而不是通过评论发布代码。此外,代码有不同的错误,而不是图像上的错误。你应该澄清这个问题。我确定问题的根源在于动作映射。
-
请发布文字,而不是图片。
-
还不行,sclv。谢谢。
-
没有为命名空间 [/] 和动作名称 [home] 映射的动作。
标签: java jsp configuration struts2 http-status-code-404