`
yufei
  • 浏览: 94158 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

SSH2: Struts2 + Spring + Hibernate 的登录

阅读更多
使用分层结构,包括 dao,service,control,web层

Struts2 集成 Spring 需要以下几个步骤

1 加入struts2-spring-plugin-2.0.9.jar到项目中(web项目就是丢到/WEB-INF/lib中)

2 Web.xml文件里加入以下listener
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--默认加载/WEB-INF 目录下的applicationContext.xml -->

如果需要其它的spring配置文件可以在web.xml中加入以下配置
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>
</context-param>
<!--param-value 中间的多个配置文件可以使用 , 隔开-->


3 在/WEB-INF 目录下新建applicationContext.xml,并在其中配置Struts2的action及其它需要的bean

4 在struts.xml中将 <action 元素中 class="" 的属性改为spring配置文件中的id
         <!-- spring 配置文件中配置 action -->
 <bean id="loginAction" class="login.LoginAction"
		scope="prototype">
		<property name="userService" ref="userService" />
	</bean>


         <!-- struts 配置文件中配置 action 注意class属性不再是类带路径全名了 -->
 <action name="Login" class="loginAction">
			<result name="success">/login/success.jsp</result>
			<result name="error">/login/error.jsp</result>
	</action>


-
-
-

Spring 集成 Hibernate 就不累述了,网上到处都有

-
-

附件里有原代码,导入eclipse(需要myeclipse插件),修改数据源,就能运行了

数据源在src目录下dataSource.properties里,我将数据源配置在外部properties

文件里,spring的配置文件动态载入其内容,如果使用的不是mysql,请注意修改hibernate方言
<prop key="hibernate.dialect">
    org.hibernate.dialect.MySQLDialect
</prop>


说明:项目内没有所需要的包(struts2,spring2,hibernate3),导入项目以后需要自己

导入相应的三方包,spring使用的是2.0

-

struts2 好像支持不了spring2.0 基于 XML Schmea 的配置,基于这个配置事务应用程序就出错,如果有人知道怎么在struts2集成spring2中使用spring2的xml Schmea的配置,请告知
  • SSH2.rar (18.5 KB)
  • 描述: Struts2 + Spring + Hibernate 的登录
  • 下载次数: 6992
分享到:
评论
35 楼 largelove 2008-10-01  
动不动就层啊层,层个毛。 就那点玩意,不要老是把层说出来,你所谓的层不过是一个工厂把一个大的东西分成很多部分,然后由不同的人去完成而已。 程序也就这点花头。
34 楼 lanniao 2008-10-01  
支持 我正好用上
33 楼 jiangweilou 2008-09-12  
2008-9-12 9:14:46 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:zhhit2' did not find a matching property.
2008-9-12 9:14:46 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:jwl' did not find a matching property.
2008-9-12 9:14:46 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_15\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jre1.5.0_15\bin\client;C:\Program Files\Java\jre1.5.0_15\bin;%JAVA_HOME%\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN
2008-9-12 9:14:47 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2008-9-12 9:14:47 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 4599 ms
2008-9-12 9:14:48 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2008-9-12 9:14:48 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.16
2008-9-12 9:14:52 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-default.xml]
2008-9-12 9:14:53 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-plugin.xml]
2008-9-12 9:14:53 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts.xml]
2008-9-12 9:14:53 org.apache.struts2.config.Settings getLocale
警告: Settings: Could not parse struts.locale setting, substituting default VM locale
2008-9-12 9:14:55 com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory <clinit>
信息: Setting DefaultObjectTypeDeterminer as default ...
2008-9-12 9:14:57 org.apache.catalina.core.StandardContext addApplicationListener
信息: The listener "org.springframework.web.context.ContextLoaderListener" is already configured for this context. The duplicate definition has been ignored.
log4j:WARN No appenders could be found for logger (org.springframework.util.ClassUtils).
log4j:WARN Please initialize the log4j system properly.
2008-9-12 9:14:58 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2008-9-12 9:15:01 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/beans.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [Person.hbm.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1260)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:438)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:394)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:736)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.io.FileNotFoundException: class path resource [Person.hbm.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:142)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:633)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1257)
... 29 more
2008-9-12 9:15:01 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2008-9-12 9:15:01 org.apache.catalina.core.StandardContext start
严重: Context [/jwl] startup failed due to previous errors
2008-9-12 9:15:01 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
2008-9-12 9:15:01 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2008-9-12 9:15:02 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2008-9-12 9:15:02 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/235  config=null
2008-9-12 9:15:02 org.apache.catalina.startup.Catalina start
信息: Server startup in 15191 ms
是什么地方出错啦??  还是不怎么清楚ssh2的配置 帮忙看看吧!
32 楼 huobao89 2008-08-28  
谢谢  感谢
31 楼 haose 2008-07-24  
struts2结合spring、hibernate开发的到是没有实现过。不过struts、spring、hibernate开发的有比较详细的记述,可以去http://www.hao-se.cn去看看
30 楼 lingsql 2008-07-23  
看懂了一些
29 楼 sinostone 2008-06-19  
楼主,我看了你的配置文件,struts.xml中未指定struts动作由spring来接管,但是却在spring的配置文件中注入了struts的动作。请问这是怎么回事,是不是哪里出了差错?
28 楼 xiquwgugou 2008-04-25  
nice job,这三个结合,我觉得包最难受,老出错。
27 楼 jackzhangyunjie 2008-03-30  
不明白你为什么要在Spring中配置Action的Bean,根本没有这个必要的。
Action里只用把Spring的Bean注入过来就可以用啦。
还有你有代码合理性有问题。
26 楼 moses3017 2008-03-20  
Please use zip to compress, I can not open it on Linux.Thank you.
25 楼 ericxu131 2008-03-20  
<div class='quote_title'>fuliang 写道</div><div class='quote_div'><div class='quote_title'>kyo100900 写道</div><div class='quote_div'>不错,可以继续重构。不过你所说的:“struts2 好像支持不了spring2.0 基于 XML Schmea 的配置,基于这个配置事务应用程序就出错”。我没有太明白</div><br/>我使用的是XML Schmea 的配置没有出现问题. <br/><pre name='code' class='xml'>&lt;aop:config&gt;
   &lt;aop:pointcut id="serviceOperation" expression="execution(* edu.jlu.fuliang.Service.impl.*ServiceImpl.*(..))"/&gt;
   &lt;aop:advisor pointcut-ref="serviceOperation" advice-ref="txAdvice"/&gt;
&lt;/aop:config&gt;
&lt;tx:advice id="txAdvice"&gt;
&lt;tx:attributes&gt;
   &lt;tx:method name="get*" read-only="true"/&gt;
   &lt;tx:method name="*"/&gt;
&lt;/tx:attributes&gt;
&lt;/tx:advice&gt;

&lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
&lt;property name="sessionFactory"&gt;
&lt;ref bean="sessionFactory"/&gt;
&lt;/property&gt;
&lt;/bean&gt;
</pre></div><br/><br/><br/><pre name='code' class='xml'> &lt;aop:config proxy-target-class="true"&gt;
&lt;aop:pointcut id="managerPointcut"
expression="execution(* com..*.*Manager.*(..))" /&gt;
&lt;aop:advisor id="managerTx" pointcut-ref="managerPointcut"
advice-ref="txAdvice" order="0" /&gt;
&lt;/aop:config&gt;
&lt;tx:advice id="txAdvice"
transaction-manager="dataSourceTransactionManager"&gt;
&lt;tx:attributes&gt;
&lt;tx:method name="insert*" propagation="REQUIRED" /&gt;
&lt;tx:method name="find*" propagation="REQUIRED"
read-only="true" /&gt;
&lt;tx:method name="update*" propagation="REQUIRED" /&gt;

&lt;tx:method name="delete*" propagation="REQUIRED" /&gt;
&lt;tx:method name="*" read-only="true" /&gt;
&lt;/tx:attributes&gt;
&lt;/tx:advice&gt;
</pre><p>我这个配置就不行<img title='sad' src='../../../../../../images/smiles/icon_sad.gif' border='0' alt='sad'/></p><p>非常奇怪</p><p>而且我每次访问action几次以后就访问不了action了 白屏 而且不进action</p><p>最可恶的是还不报错。。。。。。。</p>
24 楼 ningshuihan 2008-03-20  
楼主可以试下配置下Tomcat的日志输出,找到错误所在。开发过程也碰到过这个错误,配置了Tomcat的日志后才找到原因,Tomcat默认的日志输出有些错误提示不准确。
23 楼 ityc 2008-01-01  
看看小弟这个怎么错了?谢谢!

首先我把struts2做了一个简单的登录的实现。没有出错
主要的代码和配置文件如下:
--------------------
web.xml
-------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="person" 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">
   
    <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>/login.jsp</welcome-file>
    </welcome-file-list>
    </web-app>

-------------------------------
struts.xml
-------------------------------
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE struts PUBLIC
      "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
      "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="cn" extends="struts-default" >
		<action name="Login" class="cn.ityc.action.LoginAction">
			<result name="success">/index.jsp</result>
			<result name="error">/error.jsp</result>
		</action>
		
</package>
	
</struts>


----------------
LoginAction
-----------------
package cn.ityc.action;

public class LoginAction{
	
	private String username;
	private String password;
	
	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 String execute() throws Exception{
		if(getUsername().equals("ityc")&&getPassword().equals("ityc")){
			return "error";	
		}else{
			return "success";
		}
	}
}

------------
login.jsp
-------------

<%@ page language="java" contentType="text/html;charset=GBK"%>
<html>
<head>
<title>登录页面</title>
</head>
<body>
	<form action="Login.action" method="post">
		<table align="center">
			<caption><h3>用户登陆</h3></caption>
			<tr>
				<td>用户名:<input type="text" name="username" /></td>
			</tr>
			<tr>
				<td>密&nbsp;&nbsp;码:<input type="password" name="password" /></td>
			</tr>
			<tr align="center">
				<td colspan="2"><input type="submit" value="登录" />
			</tr>
		</table>
	</form>
</body>
</html>


----------------------------
上面没有问题
然后我想把action用spring管理
------------------------
下面我在web.xml中添加以后
----------
web.xml
-----------
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="person" 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">
   
    <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>/login.jsp</welcome-file>
    </welcome-file-list>
    <context-param>
    	<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
    </context-param>
	<servlet> 
	<servlet-name>SpringContextServlet</servlet-name> 
	<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class> 
	<load-on-startup>1</load-on-startup> 
	</servlet>
</web-app>


启动tomcat以后就报错。。
-------------
错误信息
-------------
严重: Error loading WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@6f50a8
 org.springframework.web.context.ContextLoaderServlet
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1083)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4045)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4351)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2008-1-1 13:48:32 org.apache.catalina.core.StandardContext loadOnStartup
严重: Servlet /kongtiaoDemo threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1083)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4045)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4351)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2008-1-1 13:48:32 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2008-1-1 13:48:33 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2008-1-1 13:48:33 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/31  config=null
2008-1-1 13:48:33 org.apache.catalina.startup.Catalina start
信息: Server startup in 9935 ms


我用的spring和hibernate是用myeclipse加载的包

我弄了整整40个小时了。
网上说是hibernate和spring的包冲突
我也弄不明白。

有哪位仁兄,有过这个经历请指点一下。我的QQ:531345341
QQ技术群:26572256
22 楼 ityc 2008-01-01  
楼主您好
你的所使用的jar能给我发一下吗?wwwityc@126.com
或者是名字,截图。都行。
小弟再次谢过
21 楼 sbitxmtd2008 2007-12-26  
十分感谢
20 楼 zhuwei2008 2007-12-18  
有更大一点的例子吗?
可以给我参考一下吗?
我想在毕业之季做个比较强的东西.以便能找份好的工作.
19 楼 oruja 2007-12-16  
我也碰到测试时报错说dataSource.properties不存在的问题,不知道是哪个环节出了错误??
18 楼 jackson1225 2007-11-22  
请问:源码success.jsp中
欢迎${request.user.name}

可以显示吗?为什么我用了之后不显示用户名,而是原样输出!
另外我在LoginAction中加入了
ActionContext ctx = ActionContext.getContext();
ctx.getSession().put("username",user.getName());

在success.jsp中加入
<s:property value="username" />
<s:property value="#{sessionScope.username}"/>
${sessionScope.username}

都不能正确显示用户名!而我不用spring,只用struts就可以正确输出.如果用了spring,即使action不用spring管理都不会正确显示.不知是什么原因啊,都整了一天了,各位有碰到过这样的问题吗?
17 楼 bruceye 2007-11-20  
看过     
16 楼 zh950 2007-11-20  
楼主你好,我前几天也做了一个类似的东西,在form中,action=xxx,xxx必须加.action,否则提交时不能自动加上.action后缀,但是在同一页面中,用url引用时,就能自动加上.action后缀,我用的是struts2.0.9,spring是2.0.6。不知道是怎么回事。
刚下载了你的源码,回去试一下。

相关推荐

Global site tag (gtag.js) - Google Analytics