发帖的时候写错了点东西,struts2.xml文件名写错了,应该是struts.xml
解决方案 »
- linux spring quarts 不能启动
- org.hibernate.exception.GenericJDBCException: could not insert: [org.cn.com.wceb
- mina框架中Iosession的setWriteTimeout()方法作用
- 关于el的问题
- 关于Compass(Lucene)全文搜索技术问题
- xsl中找个函数方法,请高手帮我看看
- 初学struts2,请看看简单例子为什么报404错误
- hibernate中,为什么添加两个员工只有后面一个被添加,还有一个只有Id,其它都为null
- 100分求Acegi最新版本结合数据库认证实例
- 关于在eclipse中配置tomcat插件的问题
- servlet是不是有个标签配置默认登录<isLogin></isLogin>?
- 模糊查询
这个路径写错了。
<package name="strutsqs" extends="struts-default">
既然package指定name了。在访问的时候,就得把这个加上
改为 <form action="strutsqs/Login.action" method="post"> 试试吧!
另一个你是这样写的 <filter-name>Struts2</filter-name>大小写。
你确认你启动的时候没有报错
<div class="nn"><input type="text" name="hello" /></div>
<div class="nn"><input type="password" name="hi" /></div>
<div class="nn"><input type="submit" value="提交"></div>
</form>
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="test" extends="struts-default" namespace="/">
<action name="ddd" class="qaction.kkk" method="sss">
<result name="success" >
/success.jsp
</result>
</action>
</package>
</struts>
qaction包下kkk.javapackage qaction;import com.opensymphony.xwork2.ActionSupport;
import javax.persistence.Entity;
public class kkk extends ActionSupport {
private String hello;
public String getHello() {
return hello;
}
public void setHello(String hello) {
this.hello = hello;
}
public String getHi() {
return hi;
}
public void setHi(String hi) {
this.hi = hi;
}
private String hi;
public String sss()
{
if(hello.equals("hhh")&&hi.equals("nnn"))
return SUCCESS;
else
return "nono";
}
}web.xml<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
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_2_5.xsd">
<display-name></display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</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>
Struts2的包
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-logging-1.1.jar
freeer-2.3.13.jar
ognl-2.6.11.jar
struts2-core-2.1.6.jar
xwork-2.1.2.jar
这样有出现404
没配置struts2 tomcat就是true 一配置tomcat就false