这个struts.xml的内容
<?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> <package name="default" namespace="/" extends="struts-default"> <action name="login" class="com.jacksen.struts2Demo01.UserAction"> <result>/userlogin.jsp</result> </action> <action name="check" class="com.jacksen.struts2Demo01.UserAction" method="execute"> <result name="success">/success.jsp</result> <result name="fail">/fail.jsp</result> </action> </package> <!-- Add packages here --> </struts> |
|
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <display-name>Struts2Demo</display-name> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> |
|
url 是 什么?
|
|
http://localhost/Struts2_Demo01/login.action
|
|
问题解决了。我的action类忘了继承【ActionSupport】这个类了。
唉,真是粗心大意。 加上了之后,在地址栏中输入http://localhost/Struts2_Demo01/login.action,就没有错误了。 |
|
20分 |
|
多谢! |
|
我配置的时候 action没有继承ACctionSupport能运行啊,能访问action
structs。xml: <constant name=”struts.enable.DynamicMethodInvocation” value=”true” /> <constant name=”struts.devMode” value=”true” /> JSP: |