- 浏览: 145500 次
- 来自: ...
最新评论
-
安铁辉:
亲,问题解决了吗,我也遇到类似的问题,我是想cygwin+ma ...
nutch1.0 cygwin eclipse问题 -
bk41:
不明白···
Spring中的destroy-method="close"- - -
蓝月儿:
嗯 如果把得到的数据再放到一个列表显示在界面上呢,该怎么放置呢 ...
用SAX API解析XML文档为Java对象 -
zhaotao_king:
没看明白
Spring中的destroy-method="close"- - -
coffeesweet:
java.beans确实应该好好看看,了解一下,楼主的例子很好 ...
关于Spring属性编辑器详解
web.xml
<?xml version="1.0" encoding="GBK"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
application-Context.xml
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE beans PUBLIC "spring" "../../../lib/spring-beans.dtd" >
<beans default-autowire="no" default-dependency-check="none"
default-lazy-init="false">
<!--
配置数据源
注意: 用org.apache.commons.dbcp.BasicDataSource, 要引入 apache commons
的commons-collections-3.1.jar, commons-dbcp-1.2.1.jar, commons-pool-1.2.jar三个包
-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<!--<value>oracle.jdbc.OracleDriver</value>-->
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@192.168.1.88:1521:sinitek</value>
</property>
<property name="username">
<value>test</value>
</property>
<property name="password">
<value>test</value>
</property>
</bean>
<!-- 配置sessionFactory, 注意这里引入的包的不同 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="mappingResources">
<list>
<value>test/struts/Regiest.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.OracleDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<!-- 设置c3p0连接池 -->
<!-- <prop key="hibernate.c3p0.minPoolSize">0</prop>
<prop key="hibernate.c3p0.maxPoolSize">5</prop>
<prop key="hibernate.c3p0.timeout">600</prop>
<prop key="hibernate.c3p0.max_statement">200</prop>-->
</props>
</property>
</bean>
<!-- 配置transactionManager, 注意这里引入的包的不同 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!--Regiest事务代理配置 -->
<bean id="RegiestDaoProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
singleton="true">
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="target">
<ref local="regiestDAO"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<!--Login事务代理配置 -->
<bean id="LoginDaoProx"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
singleton="true">
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="target">
<ref local="loginDao"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<!-- Hibernate 模板 -->
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 配置注册类的会话工厂 -->
<bean id="regiestDAO" class="test.dao.RegiestDao">
<!--singleton="true">-->
<property name="hibernateTemplate" ref="hibernateTemplate"/>
<!-- <property name="sessionFactory">
<ref local="sessionFactory"/>
</property>-->
</bean>
<!-- struts context-->
<bean name="/regiestaction"
class="test.struts.RegiestAction"
singleton="false">
<property name="regiestdao">
<ref local="RegiestDaoProxy"/>
</property>
</bean>
<bean id="loginDao" class="test.dao.LoginDaoImp">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean name="/loginaction" class="test.struts.LoginAction"
singleton="false">
<property name="logindao">
<ref local="LoginDaoProx"/>
</property>
</bean>
</beans>
struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="loginForm" type="test.struts.LoginForm"/>
<form-bean name="regiestForm" type="test.struts.RegiestForm"/>
</form-beans>
<!-- <global-forwards>
<forward name="regiest" path="/regiest.jsp"/>
</global-forwards>-->
<!-- type="org.springframework.web.struts.DelegatingActionProxy"-->
<!--type="org.springframework.web.struts.DelegatingActionProxy"-->
<action-mappings>
<action path="/loginaction"
type="test.struts.LoginAction"
name="loginForm"
scope="request"
validate="false"
input="/login.jsp">
<forward name="failure" path="/messageFailure.jsp"/>
<forward name="success" path="/messageSuccess.jsp"/>
</action>
<action path="/regiestaction"
type="test.struts.RegiestAction"
name="regiestForm"
scope="request"
validate="false"
input="/regiest.jsp">
<forward name="regiestFailure" path="/regiest.jsp"/>
<forward name="regiestSuccess" path="/regiestMessageSuccess.jsp"/>
</action>
</action-mappings>
<message-resources parameter="test.struts.application"/>
<!-- <controller
processorClass="org.springframework.web.struts.DelegatingRequestProcessor"/>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationsContext.xml"/>
</plug-in>-->
</struts-config>
hibernate.cfg.xml
<?xml version='1.0' encoding='GBK'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">test</property>
<property name="connection.url">jdbc:oracle:thin:@192.168.1.88:1521:sinitek</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="connection.password">test</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<!-- mapping files -->
<mapping resource="test/struts/Regiest.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Regiest.hbm.xml
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<!-- Created Thu Apr 14 21:57:25 CST 2005 -->
<hibernate-mapping package="test.struts">
<class name="Regiest" table="REGIEST_TABLE">
<id name="id" column="ID" type="java.lang.Integer">
<generator class="sequence">
<param name="sequence">seq_wf_entry</param>
</generator>
</id>
<!-- <id name="docId" type="string">
<column name="DOC_ID" length="10"/>
<generator class="test.struts.MySequenceGenerator">
<param name="sequence">DOCUMENT_SEQUENCE</param>
</generator>
</id>-->
<!-- <id name="ID" type="java.lang.Long">
<generator class="native"/>
</id>-->
<!--<property name="emails" column="EMAIL" type="UserType.EMailList"/>-->
<!--<property name="age" column="AGE" type="java.lang.String"/>-->
<property name="name" column="NAME" type="java.lang.String"/>
<property name="password" column="PASSWORD" type="java.lang.String"/>
<property name="sex" column="SEX" type="java.lang.String"/>
<property name="email" column="EMAIL" type="java.lang.String"/>
<property name="age" column="AGE" type="UserType.IntType"/>
</class>
</hibernate-mapping>
RegiestForm
package test.struts;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class RegiestForm extends ActionForm
{
private String regiestname;
private String regiestpassword;
private String tworegiestpassword;
private String sex;
private String email;
private String age;
public String getRegiestname()
{
return regiestname;
}
public void setRegiestname( String regiestname )
{
this.regiestname = regiestname;
}
public String getRegiestpassword()
{
return regiestpassword;
}
public void setRegiestpassword( String regiestpassword )
{
this.regiestpassword = regiestpassword;
}
public String getTworegiestpassword()
{
return tworegiestpassword;
}
public void setTworegiestpassword( String tworegiestpassword )
{
this.tworegiestpassword = tworegiestpassword;
}
public String getSex()
{
return sex;
}
public void setSex( String sex )
{
this.sex = sex;
}
public String getEmail()
{
return email;
}
public void setEmail( String email )
{
this.email = email;
}
public String getAge()
{
return age;
}
public void setAge( String age )
{
this.age = age;
}
public void reset( ActionMapping mapping, HttpServletRequest request )
{
regiestname = null;
regiestpassword = null;
tworegiestpassword = null;
age = null;
email = null;
}
}
RegiestAction
package test.struts;
import test.struts.Jlongin;
import test.dao.*;
import java.lang.reflect.*;
import java.util.*;
import java.sql.*;
import java.rmi.*;
import javax.servlet.http.*;
import javax.naming.*;
import javax.sql.*;
import org.apache.struts.action.*;
import oracle.jdbc.driver.*;
public class RegiestAction extends Action
{
/*RegiestDaoInterface regiestdao;
public RegiestDaoInterface getRegiestdao()
{
return regiestdao;
}
public void setRegiestdao( RegiestDaoInterface regiestdao )
{
this.regiestdao = regiestdao;
}
*/
private String foo;
private String bar;
public ActionForward execute( ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest request,
HttpServletResponse httpServletResponse )
{
RegiestForm uaf = ( RegiestForm ) actionForm;
String username = uaf.getRegiestname(); //获得用户名
String password = uaf.getRegiestpassword(); //获得密码
String sex = uaf.getSex(); //获得性别
String email = uaf.getEmail(); //获得email
String age = uaf.getAge(); //获得年龄
System.out.println( username + " " + password + " " + sex + " " + email + " " + age );
ActionErrors errors = new ActionErrors();
Jlongin jlogin = new Jlongin();
//严整用户名重复
//System.out.println("用户名重复 benig");
//运用hibernate验证户名重复
if ( !jlogin.jregiestf( username ) )
{
//用以显示用户名重复
errors.add( "usernameregiest", new ActionMessage( "regiest.name", username ) );
saveErrors( request, errors );
//System.out.println("用户名重复 midder");
//失败,跳回到原页面regiest.jsp
return actionMapping.getInputForward();
//return actionMapping.findForward( "regiestFailure" );
}
//插入注册信息
Regiest regiest = new Regiest( username, password, sex, email, age );
//Regiest regiest=new Regiest();
/* regiest.setName( username);
regiest.setPassword( password);
regiest.setSex( sex);
regiest.setEmail( email);
regiest.setAge( age);*/
//hibernate方法
if(jlogin.hbminsertRegiestmessage(regiest)){
/* //spring方法
if ( regiestdao.insertRegiestinfo( regiest ) )
{*/
errors.add( "usernameregiestfail", new ActionMessage( "regiest.fail", username ) );
saveErrors( request, errors );
//注册失败,跳回到原页面regiest.jsp
return actionMapping.getInputForward();
//return actionMapping.findForward( "regiestFailure" );
}
//jlogin.insertRegiestmessage( username, password, sex, email, age );
/* org.hibernate.Session s = HibernateUtil.currentSession();
String hql = "from REGIEST_TABLE";
try
{
org.hibernate.Query query = s.createQuery( hql );
java.util.List msgList = query.list();
test.struts.Regiest msg = ( test.struts.Regiest ) msgList.get( 0 );
//System.out.println( msg.getId() );
System.out.println( msg.getName() );
System.out.println( msg.getPassword() );
}
catch ( org.hibernate.HibernateException e )
{
e.printStackTrace();
}
HibernateUtil.closeSession();*/
//注册成功,显示注册成功页面
return ( actionMapping.findForward( "regiestSuccess" ) );
}
}
RegiestDao
package test.dao;
import java.util.Map;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import test.struts.*;
public class RegiestDao extends HibernateDaoSupport
implements RegiestDaoInterface
{
public boolean insertRegiestinfo( Regiest regiest )
{
getHibernateTemplate().saveOrUpdate(regiest);
return false; //表示返回成功
}
}
RegiestDaoInterface
package test.dao;
import test.struts.*;
public interface RegiestDaoInterface
{
public abstract boolean insertRegiestinfo( Regiest regiest);
}
Jlongin
package test.struts;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.naming.*;
import org.hibernate.*;
import org.hibernate.criterion.*;
import test.struts.test.*;
public class Jlongin
{
DataSource ds = null; //声明数据源
//获得数据源
public DataSource getDataSource()
{
try
{
Context ctx = new InitialContext();
ds = ( DataSource ) ctx.lookup( "java:/comp/env/Sinitek" );
}
catch ( NamingException e )
{
e.printStackTrace();
//return actionMapping.findForward( "globlError" );
}
return ds;
}
//验证用户名和密码是否正确
/* public boolean jlongintest( String name, String password )
{
boolean flag = false; //用以判断用户名和密码是否正确
ds = getDataSource();
if ( ds != null )
{
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try
{
conn = ds.getConnection();
String sql = "select * from regiest_table where name=? and password=?";
ps = conn.prepareStatement( sql );
ps.setString( 1, name );
ps.setString( 2, password );
//查询用户名是否存在
rs = ps.executeQuery( sql );
//如果rs.next()返回有值,代表该用户名存在,
if ( rs.next() )
{
flag = true;
}
}
catch ( SQLException e )
{
if ( conn != null )
{
try
{
conn.rollback();
}
catch ( SQLException ex )
{
ex.printStackTrace();
}
}
System.err.println( "链接数据库失败!" );
e.printStackTrace();
}
//释放资源
finally
{
if ( conn != null )
{
try
{
conn.close();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
}
return flag;
}*/
//验证用户名重复
/*public boolean jregiestf( String name )
{
boolean flag = true; //用以判断用户名是否重复
String username = name;
ds = getDataSource();
if ( ds != null )
{
Connection conn = null;
Statement ps = null;
ResultSet rs = null;
try
{
conn = ds.getConnection();
ps = conn.createStatement();
System.out.println( "yanzheng name=" + name );
//查询用户名
//String sql = "select name from regiest_table where name=" + name;
//rs = ps.executeQuery( "select name from regiest_table where name= 55");
//+ name );
rs = ps.executeQuery( "select name,password from regiest_table where name='" + username + "'" );
//如果rs.next()返回有值,代表该用户名已经被注册过
// rs.next();
// System.out.println("rs rs.getString"+rs.getString( 1));
if ( rs.next() )
{
flag = false;
}
}
catch ( SQLException e )
{
if ( conn != null )
{
try
{
conn.rollback();
}
catch ( SQLException ex )
{
ex.printStackTrace();
}
}
System.out.println( "Caught: " + e );
System.err.println( "链接数据库失败!" );
}
//释放资源
finally
{
if ( conn != null )
{
try
{
conn.close();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
}
return flag;
}*/
//插入注册信息
public void insertRegiestmessage
( String username, String password, String sex, String email, String age )
{
System.out.println( "insert Regiestmessage begin>>1" );
ds = getDataSource();
if ( ds != null )
{
System.out.println( "insert Regiestmessage begin>>2" );
Connection conn = null;
PreparedStatement ps = null;
try
{
System.out.println( "insert Regiestmessage begin>>3" );
conn = ds.getConnection();
conn.setAutoCommit( false );
ps = conn.prepareStatement( "insert into regiest_table(" +
"name,password,sex,email,age) values (?,?,?,?,?)" );
ps.setString( 1, username );
ps.setString( 2, password );
ps.setString( 3, sex );
ps.setString( 4, email );
ps.setString( 5, age );
ps.execute();
conn.commit();
}
catch ( SQLException e )
{
if ( conn != null )
{
try
{
conn.rollback();
}
catch ( SQLException ex )
{
ex.printStackTrace();
}
}
System.out.println( "Caught: " + e );
System.err.println( "链接数据库失败!" );
}
finally
{
if ( ps != null )
{
try
{
ps.close();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
if ( conn != null )
{
try
{
conn.close();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
}
}
//运用hibernate验证用户名重复
public boolean jregiestf( String name )
{
org.hibernate.Session session = HibernateUtil.currentSession();
boolean flag = true;
try
{
Iterator iterator = session.createQuery( "select " +
"distinct name from Regiest where" +
" name='" + name + "'" ).list().iterator();
if ( iterator.hasNext() )
flag = false; /*如果为false,表示此用户名已被使用*/
/*List listcriteria = ( List ) session.createCriteria( Regiest.class );
listcriteria.add( Expression.eq( "name", name ) );
if ( !listcriteria.isEmpty() )
{
flag = false;
}*/
}
catch ( org.hibernate.HibernateException e )
{
e.printStackTrace();
throw new UserLoginException( "用户名已存在!", e, "001" );
}
finally
{
HibernateUtil.closeSession();
}
return flag;
}
//运用hibernate验证用户名和密码是否正确
public boolean jlongintest( String name, String password )
{
org.hibernate.Session session = HibernateUtil.currentSession();
boolean flag = true;
try
{
Iterator iterator = session.createQuery( "select " +
"distinct name from Regiest where" +
" name='" + name + "' and password='" + password + "'" )
.list().iterator();
if ( iterator.hasNext() )
{
flag = false;
}
/* Query query=session.createQuery( "from Regiest as re" +
" where re.name=:name and re.password=:password ");
query.setString( "name",name);
query.setString( "password",password);*/
/* query.setParameter( 1,name);
query.setParameter( 2,password);*/
/* List list=query.list();
if(!list.isEmpty()){
flag=false;
}*/
/* List listcriteria = session.createCriteria( Regiest.class ).
add( Expression.eq( "name", name ) ).
add( Expression.eq( "password", password ) ).list();
if ( !listcriteria.isEmpty() )
{
flag = false;
}*/
}
catch ( org.hibernate.HibernateException e )
{
e.printStackTrace();
throw new UserLoginException( "登陆失败!", e, "001" );
}
finally
{
HibernateUtil.closeSession();
}
return flag;
}
//运用hibernate插入注册信息
public boolean hbminsertRegiestmessage( Regiest regiest ) throws UserLoginException
{
org.hibernate.Session session = HibernateUtil.currentSession();
Transaction tx = null;
boolean flag = true;
try
{
tx = session.beginTransaction();
//session.createSQLQuery( )createQuery( )
//session.
session.save( regiest );
tx.commit();
flag = false;
}
catch ( org.hibernate.HibernateException e )
{
if ( tx != null )
{
tx.rollback();
}
e.printStackTrace();
throw new UserLoginException( "注册失败!", e, "001" );
}
finally
{
HibernateUtil.closeSession();
}
return flag;
}
}
HibernateUtil
package test.struts;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
private static Log log = LogFactory.getLog(HibernateUtil.class);
private static final SessionFactory sessionFactory;
static {
try {
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
log.error("Initial SessionFactory creation failed.", ex);
throw new ExceptionInInitializerError(ex);
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession() {
Session s = (Session) session.get();
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}
public static void closeSession() {
Session s = (Session) session.get();
if (s != null)
s.close();
session.set(null);
}
}
IntType
package UserType;
import org.hibernate.usertype.*;
import java.io.Serializable;
import java.sql.Types;
import java.util.*;
import org.hibernate.type.*;
import org.hibernate.*;
import javax.sql.*;
import java.sql.*;
public class IntType implements UserType, Serializable
{
public static final int[] TYPES = new int[]{Types.VARCHAR};
public int[] sqlTypes()
{
return TYPES;
}
public Class returnedClass()
{
return Integer.class;
}
public boolean equals( Object object, Object object1 ) throws HibernateException
{
if ( object == object1 )
{
return true;
}
return false;
}
public int hashCode( Object object ) throws HibernateException
{
return 0;
}
public Object nullSafeGet( ResultSet resultSet, String[] strings, Object object )
throws HibernateException, SQLException
{
String value = ( String ) Hibernate.STRING.nullSafeGet( resultSet, strings[0] );
if ( value != null )
{
return strtointeger( value );
}
else
{
return Collections.EMPTY_LIST;
}
}
private Integer strtointeger( String value )
{
Integer i = Integer.valueOf( value );
return i;
}
public void nullSafeSet( PreparedStatement preparedStatement, Object object, int i )
throws HibernateException, SQLException
{
if ( object != null )
{
Object str = integertostr( object );
Hibernate.STRING.nullSafeSet( preparedStatement, str, i );
}
else
{
Hibernate.STRING.nullSafeSet( preparedStatement, object, i );
}
}
private Object integertostr( Object value )
{
return ( Object ) String.valueOf( value );
}
public Object deepCopy( Object object ) throws HibernateException
{
Integer integer=null;
//integer = new Integer();
if ( object == null )
{
return integer;
}
Integer sourceinteger = ( Integer ) object;
return sourceinteger;
}
public boolean isMutable()
{
return false;
}
public Serializable disassemble( Object object ) throws HibernateException
{
return null;
}
public Object assemble( Serializable serializable, Object object ) throws HibernateException
{
return null;
}
public Object replace( Object object, Object object1, Object object2 ) throws HibernateException
{
return null;
}
}
log4j.property
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.rootLogger=warn,stdout
由于不断地加代码,代码乱了点,希望加以整理。
<?xml version="1.0" encoding="GBK"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
application-Context.xml
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE beans PUBLIC "spring" "../../../lib/spring-beans.dtd" >
<beans default-autowire="no" default-dependency-check="none"
default-lazy-init="false">
<!--
配置数据源
注意: 用org.apache.commons.dbcp.BasicDataSource, 要引入 apache commons
的commons-collections-3.1.jar, commons-dbcp-1.2.1.jar, commons-pool-1.2.jar三个包
-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<!--<value>oracle.jdbc.OracleDriver</value>-->
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@192.168.1.88:1521:sinitek</value>
</property>
<property name="username">
<value>test</value>
</property>
<property name="password">
<value>test</value>
</property>
</bean>
<!-- 配置sessionFactory, 注意这里引入的包的不同 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="mappingResources">
<list>
<value>test/struts/Regiest.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.OracleDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<!-- 设置c3p0连接池 -->
<!-- <prop key="hibernate.c3p0.minPoolSize">0</prop>
<prop key="hibernate.c3p0.maxPoolSize">5</prop>
<prop key="hibernate.c3p0.timeout">600</prop>
<prop key="hibernate.c3p0.max_statement">200</prop>-->
</props>
</property>
</bean>
<!-- 配置transactionManager, 注意这里引入的包的不同 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!--Regiest事务代理配置 -->
<bean id="RegiestDaoProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
singleton="true">
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="target">
<ref local="regiestDAO"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<!--Login事务代理配置 -->
<bean id="LoginDaoProx"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
singleton="true">
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="target">
<ref local="loginDao"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<!-- Hibernate 模板 -->
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 配置注册类的会话工厂 -->
<bean id="regiestDAO" class="test.dao.RegiestDao">
<!--singleton="true">-->
<property name="hibernateTemplate" ref="hibernateTemplate"/>
<!-- <property name="sessionFactory">
<ref local="sessionFactory"/>
</property>-->
</bean>
<!-- struts context-->
<bean name="/regiestaction"
class="test.struts.RegiestAction"
singleton="false">
<property name="regiestdao">
<ref local="RegiestDaoProxy"/>
</property>
</bean>
<bean id="loginDao" class="test.dao.LoginDaoImp">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean name="/loginaction" class="test.struts.LoginAction"
singleton="false">
<property name="logindao">
<ref local="LoginDaoProx"/>
</property>
</bean>
</beans>
struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="loginForm" type="test.struts.LoginForm"/>
<form-bean name="regiestForm" type="test.struts.RegiestForm"/>
</form-beans>
<!-- <global-forwards>
<forward name="regiest" path="/regiest.jsp"/>
</global-forwards>-->
<!-- type="org.springframework.web.struts.DelegatingActionProxy"-->
<!--type="org.springframework.web.struts.DelegatingActionProxy"-->
<action-mappings>
<action path="/loginaction"
type="test.struts.LoginAction"
name="loginForm"
scope="request"
validate="false"
input="/login.jsp">
<forward name="failure" path="/messageFailure.jsp"/>
<forward name="success" path="/messageSuccess.jsp"/>
</action>
<action path="/regiestaction"
type="test.struts.RegiestAction"
name="regiestForm"
scope="request"
validate="false"
input="/regiest.jsp">
<forward name="regiestFailure" path="/regiest.jsp"/>
<forward name="regiestSuccess" path="/regiestMessageSuccess.jsp"/>
</action>
</action-mappings>
<message-resources parameter="test.struts.application"/>
<!-- <controller
processorClass="org.springframework.web.struts.DelegatingRequestProcessor"/>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationsContext.xml"/>
</plug-in>-->
</struts-config>
hibernate.cfg.xml
<?xml version='1.0' encoding='GBK'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">test</property>
<property name="connection.url">jdbc:oracle:thin:@192.168.1.88:1521:sinitek</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="connection.password">test</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<!-- mapping files -->
<mapping resource="test/struts/Regiest.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Regiest.hbm.xml
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<!-- Created Thu Apr 14 21:57:25 CST 2005 -->
<hibernate-mapping package="test.struts">
<class name="Regiest" table="REGIEST_TABLE">
<id name="id" column="ID" type="java.lang.Integer">
<generator class="sequence">
<param name="sequence">seq_wf_entry</param>
</generator>
</id>
<!-- <id name="docId" type="string">
<column name="DOC_ID" length="10"/>
<generator class="test.struts.MySequenceGenerator">
<param name="sequence">DOCUMENT_SEQUENCE</param>
</generator>
</id>-->
<!-- <id name="ID" type="java.lang.Long">
<generator class="native"/>
</id>-->
<!--<property name="emails" column="EMAIL" type="UserType.EMailList"/>-->
<!--<property name="age" column="AGE" type="java.lang.String"/>-->
<property name="name" column="NAME" type="java.lang.String"/>
<property name="password" column="PASSWORD" type="java.lang.String"/>
<property name="sex" column="SEX" type="java.lang.String"/>
<property name="email" column="EMAIL" type="java.lang.String"/>
<property name="age" column="AGE" type="UserType.IntType"/>
</class>
</hibernate-mapping>
RegiestForm
package test.struts;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class RegiestForm extends ActionForm
{
private String regiestname;
private String regiestpassword;
private String tworegiestpassword;
private String sex;
private String email;
private String age;
public String getRegiestname()
{
return regiestname;
}
public void setRegiestname( String regiestname )
{
this.regiestname = regiestname;
}
public String getRegiestpassword()
{
return regiestpassword;
}
public void setRegiestpassword( String regiestpassword )
{
this.regiestpassword = regiestpassword;
}
public String getTworegiestpassword()
{
return tworegiestpassword;
}
public void setTworegiestpassword( String tworegiestpassword )
{
this.tworegiestpassword = tworegiestpassword;
}
public String getSex()
{
return sex;
}
public void setSex( String sex )
{
this.sex = sex;
}
public String getEmail()
{
return email;
}
public void setEmail( String email )
{
this.email = email;
}
public String getAge()
{
return age;
}
public void setAge( String age )
{
this.age = age;
}
public void reset( ActionMapping mapping, HttpServletRequest request )
{
regiestname = null;
regiestpassword = null;
tworegiestpassword = null;
age = null;
email = null;
}
}
RegiestAction
package test.struts;
import test.struts.Jlongin;
import test.dao.*;
import java.lang.reflect.*;
import java.util.*;
import java.sql.*;
import java.rmi.*;
import javax.servlet.http.*;
import javax.naming.*;
import javax.sql.*;
import org.apache.struts.action.*;
import oracle.jdbc.driver.*;
public class RegiestAction extends Action
{
/*RegiestDaoInterface regiestdao;
public RegiestDaoInterface getRegiestdao()
{
return regiestdao;
}
public void setRegiestdao( RegiestDaoInterface regiestdao )
{
this.regiestdao = regiestdao;
}
*/
private String foo;
private String bar;
public ActionForward execute( ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest request,
HttpServletResponse httpServletResponse )
{
RegiestForm uaf = ( RegiestForm ) actionForm;
String username = uaf.getRegiestname(); //获得用户名
String password = uaf.getRegiestpassword(); //获得密码
String sex = uaf.getSex(); //获得性别
String email = uaf.getEmail(); //获得email
String age = uaf.getAge(); //获得年龄
System.out.println( username + " " + password + " " + sex + " " + email + " " + age );
ActionErrors errors = new ActionErrors();
Jlongin jlogin = new Jlongin();
//严整用户名重复
//System.out.println("用户名重复 benig");
//运用hibernate验证户名重复
if ( !jlogin.jregiestf( username ) )
{
//用以显示用户名重复
errors.add( "usernameregiest", new ActionMessage( "regiest.name", username ) );
saveErrors( request, errors );
//System.out.println("用户名重复 midder");
//失败,跳回到原页面regiest.jsp
return actionMapping.getInputForward();
//return actionMapping.findForward( "regiestFailure" );
}
//插入注册信息
Regiest regiest = new Regiest( username, password, sex, email, age );
//Regiest regiest=new Regiest();
/* regiest.setName( username);
regiest.setPassword( password);
regiest.setSex( sex);
regiest.setEmail( email);
regiest.setAge( age);*/
//hibernate方法
if(jlogin.hbminsertRegiestmessage(regiest)){
/* //spring方法
if ( regiestdao.insertRegiestinfo( regiest ) )
{*/
errors.add( "usernameregiestfail", new ActionMessage( "regiest.fail", username ) );
saveErrors( request, errors );
//注册失败,跳回到原页面regiest.jsp
return actionMapping.getInputForward();
//return actionMapping.findForward( "regiestFailure" );
}
//jlogin.insertRegiestmessage( username, password, sex, email, age );
/* org.hibernate.Session s = HibernateUtil.currentSession();
String hql = "from REGIEST_TABLE";
try
{
org.hibernate.Query query = s.createQuery( hql );
java.util.List msgList = query.list();
test.struts.Regiest msg = ( test.struts.Regiest ) msgList.get( 0 );
//System.out.println( msg.getId() );
System.out.println( msg.getName() );
System.out.println( msg.getPassword() );
}
catch ( org.hibernate.HibernateException e )
{
e.printStackTrace();
}
HibernateUtil.closeSession();*/
//注册成功,显示注册成功页面
return ( actionMapping.findForward( "regiestSuccess" ) );
}
}
RegiestDao
package test.dao;
import java.util.Map;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import test.struts.*;
public class RegiestDao extends HibernateDaoSupport
implements RegiestDaoInterface
{
public boolean insertRegiestinfo( Regiest regiest )
{
getHibernateTemplate().saveOrUpdate(regiest);
return false; //表示返回成功
}
}
RegiestDaoInterface
package test.dao;
import test.struts.*;
public interface RegiestDaoInterface
{
public abstract boolean insertRegiestinfo( Regiest regiest);
}
Jlongin
package test.struts;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.naming.*;
import org.hibernate.*;
import org.hibernate.criterion.*;
import test.struts.test.*;
public class Jlongin
{
DataSource ds = null; //声明数据源
//获得数据源
public DataSource getDataSource()
{
try
{
Context ctx = new InitialContext();
ds = ( DataSource ) ctx.lookup( "java:/comp/env/Sinitek" );
}
catch ( NamingException e )
{
e.printStackTrace();
//return actionMapping.findForward( "globlError" );
}
return ds;
}
//验证用户名和密码是否正确
/* public boolean jlongintest( String name, String password )
{
boolean flag = false; //用以判断用户名和密码是否正确
ds = getDataSource();
if ( ds != null )
{
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try
{
conn = ds.getConnection();
String sql = "select * from regiest_table where name=? and password=?";
ps = conn.prepareStatement( sql );
ps.setString( 1, name );
ps.setString( 2, password );
//查询用户名是否存在
rs = ps.executeQuery( sql );
//如果rs.next()返回有值,代表该用户名存在,
if ( rs.next() )
{
flag = true;
}
}
catch ( SQLException e )
{
if ( conn != null )
{
try
{
conn.rollback();
}
catch ( SQLException ex )
{
ex.printStackTrace();
}
}
System.err.println( "链接数据库失败!" );
e.printStackTrace();
}
//释放资源
finally
{
if ( conn != null )
{
try
{
conn.close();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
}
return flag;
}*/
//验证用户名重复
/*public boolean jregiestf( String name )
{
boolean flag = true; //用以判断用户名是否重复
String username = name;
ds = getDataSource();
if ( ds != null )
{
Connection conn = null;
Statement ps = null;
ResultSet rs = null;
try
{
conn = ds.getConnection();
ps = conn.createStatement();
System.out.println( "yanzheng name=" + name );
//查询用户名
//String sql = "select name from regiest_table where name=" + name;
//rs = ps.executeQuery( "select name from regiest_table where name= 55");
//+ name );
rs = ps.executeQuery( "select name,password from regiest_table where name='" + username + "'" );
//如果rs.next()返回有值,代表该用户名已经被注册过
// rs.next();
// System.out.println("rs rs.getString"+rs.getString( 1));
if ( rs.next() )
{
flag = false;
}
}
catch ( SQLException e )
{
if ( conn != null )
{
try
{
conn.rollback();
}
catch ( SQLException ex )
{
ex.printStackTrace();
}
}
System.out.println( "Caught: " + e );
System.err.println( "链接数据库失败!" );
}
//释放资源
finally
{
if ( conn != null )
{
try
{
conn.close();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
}
return flag;
}*/
//插入注册信息
public void insertRegiestmessage
( String username, String password, String sex, String email, String age )
{
System.out.println( "insert Regiestmessage begin>>1" );
ds = getDataSource();
if ( ds != null )
{
System.out.println( "insert Regiestmessage begin>>2" );
Connection conn = null;
PreparedStatement ps = null;
try
{
System.out.println( "insert Regiestmessage begin>>3" );
conn = ds.getConnection();
conn.setAutoCommit( false );
ps = conn.prepareStatement( "insert into regiest_table(" +
"name,password,sex,email,age) values (?,?,?,?,?)" );
ps.setString( 1, username );
ps.setString( 2, password );
ps.setString( 3, sex );
ps.setString( 4, email );
ps.setString( 5, age );
ps.execute();
conn.commit();
}
catch ( SQLException e )
{
if ( conn != null )
{
try
{
conn.rollback();
}
catch ( SQLException ex )
{
ex.printStackTrace();
}
}
System.out.println( "Caught: " + e );
System.err.println( "链接数据库失败!" );
}
finally
{
if ( ps != null )
{
try
{
ps.close();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
if ( conn != null )
{
try
{
conn.close();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
}
}
//运用hibernate验证用户名重复
public boolean jregiestf( String name )
{
org.hibernate.Session session = HibernateUtil.currentSession();
boolean flag = true;
try
{
Iterator iterator = session.createQuery( "select " +
"distinct name from Regiest where" +
" name='" + name + "'" ).list().iterator();
if ( iterator.hasNext() )
flag = false; /*如果为false,表示此用户名已被使用*/
/*List listcriteria = ( List ) session.createCriteria( Regiest.class );
listcriteria.add( Expression.eq( "name", name ) );
if ( !listcriteria.isEmpty() )
{
flag = false;
}*/
}
catch ( org.hibernate.HibernateException e )
{
e.printStackTrace();
throw new UserLoginException( "用户名已存在!", e, "001" );
}
finally
{
HibernateUtil.closeSession();
}
return flag;
}
//运用hibernate验证用户名和密码是否正确
public boolean jlongintest( String name, String password )
{
org.hibernate.Session session = HibernateUtil.currentSession();
boolean flag = true;
try
{
Iterator iterator = session.createQuery( "select " +
"distinct name from Regiest where" +
" name='" + name + "' and password='" + password + "'" )
.list().iterator();
if ( iterator.hasNext() )
{
flag = false;
}
/* Query query=session.createQuery( "from Regiest as re" +
" where re.name=:name and re.password=:password ");
query.setString( "name",name);
query.setString( "password",password);*/
/* query.setParameter( 1,name);
query.setParameter( 2,password);*/
/* List list=query.list();
if(!list.isEmpty()){
flag=false;
}*/
/* List listcriteria = session.createCriteria( Regiest.class ).
add( Expression.eq( "name", name ) ).
add( Expression.eq( "password", password ) ).list();
if ( !listcriteria.isEmpty() )
{
flag = false;
}*/
}
catch ( org.hibernate.HibernateException e )
{
e.printStackTrace();
throw new UserLoginException( "登陆失败!", e, "001" );
}
finally
{
HibernateUtil.closeSession();
}
return flag;
}
//运用hibernate插入注册信息
public boolean hbminsertRegiestmessage( Regiest regiest ) throws UserLoginException
{
org.hibernate.Session session = HibernateUtil.currentSession();
Transaction tx = null;
boolean flag = true;
try
{
tx = session.beginTransaction();
//session.createSQLQuery( )createQuery( )
//session.
session.save( regiest );
tx.commit();
flag = false;
}
catch ( org.hibernate.HibernateException e )
{
if ( tx != null )
{
tx.rollback();
}
e.printStackTrace();
throw new UserLoginException( "注册失败!", e, "001" );
}
finally
{
HibernateUtil.closeSession();
}
return flag;
}
}
HibernateUtil
package test.struts;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
private static Log log = LogFactory.getLog(HibernateUtil.class);
private static final SessionFactory sessionFactory;
static {
try {
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
log.error("Initial SessionFactory creation failed.", ex);
throw new ExceptionInInitializerError(ex);
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession() {
Session s = (Session) session.get();
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}
public static void closeSession() {
Session s = (Session) session.get();
if (s != null)
s.close();
session.set(null);
}
}
IntType
package UserType;
import org.hibernate.usertype.*;
import java.io.Serializable;
import java.sql.Types;
import java.util.*;
import org.hibernate.type.*;
import org.hibernate.*;
import javax.sql.*;
import java.sql.*;
public class IntType implements UserType, Serializable
{
public static final int[] TYPES = new int[]{Types.VARCHAR};
public int[] sqlTypes()
{
return TYPES;
}
public Class returnedClass()
{
return Integer.class;
}
public boolean equals( Object object, Object object1 ) throws HibernateException
{
if ( object == object1 )
{
return true;
}
return false;
}
public int hashCode( Object object ) throws HibernateException
{
return 0;
}
public Object nullSafeGet( ResultSet resultSet, String[] strings, Object object )
throws HibernateException, SQLException
{
String value = ( String ) Hibernate.STRING.nullSafeGet( resultSet, strings[0] );
if ( value != null )
{
return strtointeger( value );
}
else
{
return Collections.EMPTY_LIST;
}
}
private Integer strtointeger( String value )
{
Integer i = Integer.valueOf( value );
return i;
}
public void nullSafeSet( PreparedStatement preparedStatement, Object object, int i )
throws HibernateException, SQLException
{
if ( object != null )
{
Object str = integertostr( object );
Hibernate.STRING.nullSafeSet( preparedStatement, str, i );
}
else
{
Hibernate.STRING.nullSafeSet( preparedStatement, object, i );
}
}
private Object integertostr( Object value )
{
return ( Object ) String.valueOf( value );
}
public Object deepCopy( Object object ) throws HibernateException
{
Integer integer=null;
//integer = new Integer();
if ( object == null )
{
return integer;
}
Integer sourceinteger = ( Integer ) object;
return sourceinteger;
}
public boolean isMutable()
{
return false;
}
public Serializable disassemble( Object object ) throws HibernateException
{
return null;
}
public Object assemble( Serializable serializable, Object object ) throws HibernateException
{
return null;
}
public Object replace( Object object, Object object1, Object object2 ) throws HibernateException
{
return null;
}
}
log4j.property
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.rootLogger=warn,stdout
由于不断地加代码,代码乱了点,希望加以整理。
相关推荐
struts hibernate spring 框架运用struts hibernate spring 框架运用struts hibernate spring 框架运用struts hibernate spring 框架运用
Struts Hibernate Spring Ajax Struts Hibernate Spring Ajax
Struts、Hibernate和Spring是Java开发中的三大框架,它们各自负责不同的职责,但协同工作时可以构建出高效、模块化的Web应用。这个压缩包“struts hibernate spring集成开发宝典光盘源码(二).rar”显然是一个用于...
《Struts Hibernate Spring集成开发宝典》以Struts,Hibernate,Spring为核心详细地讲解了这三个组件的基础知识和基本使用方法,并通过一系列集成开发实例讲解了这三个组件在J2EE项目中的应用。《Struts Hibernate ...
struts hibernate spring集成开发宝典光盘源码(一).rar
Struts、Hibernate和Spring是Java开发中非常重要的三个框架,它们在企业级应用开发中扮演着核心角色。Struts作为MVC(Model-View-Controller)框架,负责处理请求和控制应用程序流程;Hibernate是一个对象关系映射...
《Struts Hibernate Spring集成开发宝典》中文pdf版 计算机电子书下载,《Struts Hibernate Spring集成开发宝典》以Struts,Hibernate,Spring为核心详细地讲解了这三个组件的基础知识和基本使用方法,并通过一系列...
Struts、Hibernate和Spring是Java开发中非常重要的三个框架,它们在企业级应用开发中扮演着核心角色。这个实例可能是为了展示如何将这三个框架整合在一起,实现数据的增删改功能。下面将详细讲解这三个框架的基本...
《Struts Hibernate Spring 开发宝典》是一本专注于Java企业级应用开发的书籍,主要针对的是初学者和中级开发者,旨在帮助他们掌握这三个框架的综合运用。Struts、Hibernate和Spring是Java EE领域中非常重要的开源...
《Struts Hibernate Spring 集成开发宝典》是一本深度探讨企业级Java应用开发的著作,重点关注了三个核心框架的整合使用:Struts、Hibernate和Spring。这三大框架是Java Web开发中的重要组成部分,各自在不同的层面...
Struts Hibernate Spring Ajax Struts Hibernate Spring Ajax
《Struts Hibernate Spring 集成开发宝典springcore》是一部深入探讨企业级Java应用开发的经典教程,专注于三大主流框架的整合与实践。Struts、Hibernate和Spring是Java Web开发中的三大支柱,它们各自在MVC(模型-...
《Struts Hibernate Spring 集成开发宝典》是一本深度探讨Java企业级应用开发的著作,重点关注了三个核心框架的整合:Struts、Hibernate和Spring。这些框架都是Java领域中广泛使用的开源工具,它们各自在不同的层面...
《Struts Hibernate Spring 集成开发宝典》是一本深度解析Java企业级应用开发的著作,主要聚焦于三大框架——Struts、Hibernate和Spring的整合应用。这三者是Java Web开发中的核心技术,它们各自解决不同的问题,而...
struts struts hibernate spring 整合 PUBhibernstruts hibernate spring 整合 PUBate spring 整合 PUB
Struts、Hibernate、Spring 是Java Web开发中的三大框架,它们各自负责不同的职责,协同工作可以构建出高效、灵活的企业级应用程序。本集成开发宝典主要关注如何将这三者有效地结合,以ActionForm为切入点,深入讲解...
Struts、Hibernate和Spring是Java Web开发中的三大框架,它们各自负责不同的职责,共同构建了企业级应用的基础架构。在Java EE世界里,这三者的集成是常见的实践,旨在提高开发效率,降低耦合度,增强应用的可维护性...
**Struts Hibernate Spring网上商城系统详解** 在现代Web开发中,`Struts`、`Hibernate`和`Spring`是三个非常关键的框架,它们分别在表现层、持久化层和应用层发挥着重要作用。这个"Struts Hibernate Spring网上...
Struts、Hibernate 和 Spring 是Java Web开发中的三大框架,它们各自负责不同的职责,协同工作能够构建出高效、灵活的企业级应用程序。本集成开发宝典将深入讲解如何将这三者结合,实现强大的后端功能。 Struts 是...
Struts、Hibernate 和 Spring 是Java Web开发中的三大框架,它们各自负责不同的职责,共同构建了一个高效、可维护的Web应用程序架构。Struts处理MVC(Model-View-Controller)架构,Hibernate专注于对象关系映射...