这是我的hibernate持久化代码
public class Insert { public String execute(){
/* try{
TStudent tstudent = new TStudent();
Configuration config=new Configuration().configure();  
SessionFactory sessionFactory=config.buildSessionFactory();
Session session = sessionFactory.openSession();
tstudent.setStuname("jinqiu");
tstudent.setStuno("13");
session.save(tstudent);
session.flush();
}catch(HibernateException e){
e.printStackTrace();
}
*/
return "index" ;
}
}
当我把这段代码注释掉,输入http://localhost:8080/hibernate2可以进入index.jsp页面
但是当把注释去掉,输入http://localost:8080/hibernate2是就会出现404错误,找不到页面。这是为什么呢?
我的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">
<filter>
<filter-name>hibernate2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>hibernate2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>
求大神解答啊 啊啊