大家帮我看看下面这个Struts练习哪儿错了?为什么达不到效果?
资料说点击链接,能赚到Hello.jsp上面,可是我点击链接,提示找不到hello.aciton.
这个是struts.xml
<?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> <package name="com.wq" extends="struts-default" namespace="/"> <action name="hello"> <result>/hello.jsp</result> </action> </package> </struts>
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"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>struts hello world</title> </head> <body> <a href="hello.action">问好</a> </body> </html>
Hello.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"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>你好</title> </head> <body> Hello world! </body> </html>