struts hibernate 测试小例子 不报错 但数据库没反应 求分析项目在我的资源里面
本帖最后由 yjb8646226 于 2012-11-28 13:13:51 编辑
一个简单的JSP页面 账户 密码 等 存入 数据库对应表 (sqlserver)
求大神帮忙调试一下 找下哪里有问题
项目在我的资源里面 0积分下载
index.jsp
<form action="savePerson.action">
username:<input type="text" name="username" size="20"><br>
password:<input type="password" name="password" size="20"><br>
age:<input type="text" name="age" size="20">
<input type="submit" value="submit">
</form>
web.xml
<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></web-app>
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<package name="hibernate" extends="struts-default">
<action name="savePerson" class="com.yjb.action.PersonAction">
<result>/welcome.jsp</result>
</action>
</package>
</struts>
Person
package com.yjb.model;
import java.sql.Date;
public class Person {
private Integer id;
private String username;
private String password;
private Integer age;
private Date registerDate;
public Integer getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Date getRegisterDate() {
return registerDate;
}
public void setRegisterDate(Date registerDate) {
this.registerDate = registerDate;
}
}
PersonAction
package com.yjb.action;
import com.opensymphony.xwork2.ActionSupport;
import com.yjb.model.Person;
import com.yjb.service.PersonService;
import com.yjb.service.impl.PersonServiceImpl;