日期:2014-05-17  浏览次数:20647 次

struts2 + spring 整合问题
applicationContext.xml

---------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">

<beans >

<bean id="config" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="locations">

<list><value>classpath:jdbc.properties</value></list>

</property>

</bean>

<bean name="logonAction" class="struts.action.logon.LogonAction" scope="prototype">

<property name="service" ref="logonService"/>

</bean>

<bean id="logonService" class="struts.service.logon.LogonService"></bean>

</beans>

---------------------------------------------------------

谁能帮我把这段加上注释 每段都是干什么的?我是在网上照扒的 不是很理解



还有我启动tomcat的时候 除了下面的错误

class path resource [jdbc.properties] cannot be opened because it does not exist


------最佳解决方案--------------------
LZ,自己看下src目录下面是否有jdbc.properties这个文件。

------其他解决方案--------------------
没有啊。。。
那个文件应该从哪弄?
------其他解决方案--------------------
没有的话,就自己弄一下吧。。
你的先弄清楚你程序里面怎么来调用这个文件的内容的,大体就是
jdbc:driverManger:值
jdbc:userName:值。。。
就是你数据库的4个属性,呵呵!
------其他解决方案--------------------
jdbc.driverClassName=org.postgresql.Driver
jdbc.url=jdbc:postgresql://localhost:5432/test/ssh1
jdbc.username=postgres
jdbc.password=Fang1982!