struts2 跳转 你的web。xml里面配置没,你的struts.xml有没有放错位置啊!我帮你调试看看 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我把你代码的那个包名去掉了.运行一次通过....代码如下这是SayHello.jsp 页面 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ 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=ISO-8859-1"><title>Insert title here</title></head><body> <h3>Say "Hello" to: </h3> <s:form name="HelloWorld" action="HelloWorld"> Name: <s:textfield name="name" /> <s:submit> </s:submit> </s:form> </body></html>这是HelloWorld.jsp页面 <%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Hello </title> </head> <body> <h3> <s:property value="name" /> </h3> </body> </html> 这是tutorial.java package tutorial;import com.opensymphony.xwork2.ActionSupport;public class tutorial extends ActionSupport {private String name; public String getName() { return name; } public void setName(String name) { System.out.println(name); this.name = name; } public String execute()throws Exception { name = "Hello, " + name + "!"; System.out.println(name); return SUCCESS; } }这是配置文件 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts><include file="/struts-default.xml"></include><package name="tutorialone" extends="struts-default"> <action name="HelloWorld" class="tutorial.tutorial"> <result>HelloWorld.jsp </result> </action> </package> </struts> 要学会看错误信息,配置问题肯定是你的xml出问题了,要么是web.xml,要么是struts.xml。不用看别处绝对是那个地方你写错了 在Maven中如何使用自定义的checkstyle 求高手指教 struts2欢迎页面 请问各位大哥: 请教各位前辈配置J2EE环境 使用STRUTS,表单提交的数据,actionForm获取不到,是为什么呢? tomcat???? 菜鸟问题:为什么ejb要有两个借口,一个实现类 windows 2000(persional)怎么装web logic 逆向petstore的开发过程,可行吗?在线给分 怎么在ECLIPSE编译JFORUM? java解析xml文件时出现异常,请求帮助
这是SayHello.jsp 页面
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ 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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h3>Say "Hello" to: </h3>
<s:form name="HelloWorld" action="HelloWorld">
Name: <s:textfield name="name" />
<s:submit> </s:submit>
</s:form> </body>
</html>这是HelloWorld.jsp页面
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Hello </title>
</head>
<body>
<h3> <s:property value="name" /> </h3>
</body>
</html> 这是tutorial.java package tutorial;import com.opensymphony.xwork2.ActionSupport;public class tutorial extends ActionSupport {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
System.out.println(name);
this.name = name;
}
public String execute()throws Exception {
name = "Hello, " + name + "!";
System.out.println(name);
return SUCCESS;
} }
这是配置文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="/struts-default.xml"></include>
<package name="tutorialone" extends="struts-default">
<action name="HelloWorld" class="tutorial.tutorial">
<result>HelloWorld.jsp </result>
</action>
</package> </struts>