SSI (Struts 2 + Spring 2.5 + Ibatis. 2.16) 프레임 워 크 의 데이터 원본 설정.
3012 단어 struts2
일반적으로 데이터 원본 을 설정 하 는 방법 은 여러 가지 가 있 습 니 다. 어떤 것 이 더 적합 한 작업 을 해 야 하 는 지 보 세 요.
다음은 우리 가 작업 할 때 사용 하 는 데이터 원본 설정 절 차 를 말씀 드 리 겠 습 니 다.
1>> spring 의 applicationContext. xml 파일 에 데이터 원본 설정:
다음은 ibatis 의 sqlMapClient 설정 입 니 다.
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:sql-map-config.xml" />
<property name="dataSource" ref="DataSource" />
<property name="useTransactionAwareDataSource" value="true"></property>
</bean>
<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
데이터 원본 설정.
<bean id="DataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/datasource"></property>
</bean>
2 > > 두 번 째 단 계 는 웹. xml 프로필 에 tomcat 에서 설정 한 데이터 원본 을 적용 합 니 다. (데이터 원본 의 참조 이름 을 주의 하 십시오. tomcat 와 같 아야 합 니 다. 그렇지 않 으 면 데이터 원본 정 보 를 찾 을 수 없습니다.)
<resource-ref>
<description>datasource</description>
<res-ref-name>jdbc/datasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
3 > > 세 번 째 단 계 는 구체 적 인 용기 에 데이터 원본 을 설정 합 니 다. 이 예 는 tomcat - 6.0.29 와 websphere 두 가지 방식 으로 예 를 들 어 설명 합 니 다.
먼저 tomcat 를 디스크 에 압축 을 풀 고 있 습 니 다. 예 를 들 어 다음 과 같은 위치 입 니 다.
D:\apache-tomcat-6.0.29\apache-tomcat-6.0.29\conf
conf 디 렉 터 리 에서 context. xml 프로필 을 찾 습 니 다:
다음 내용 설정: ()
<?xml version='1.0' encoding='utf-8'?>
<!-- The contents of this file will be loaded for each web application -->
<Context>
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- b.Oracle 10g -->
<Resource name="jdbc/datasource"
auth="Container"
type="javax.sql.DataSource"
username="scott"
password="tiger"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@192.168.1.100:1521:ORCL"
maxActive="100"
maxIdle="10"/>
</Context>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
한 편의 문장으로 Struts2의 유형 전환을 해결하다우리는 HTTP를 통해 백그라운드에 제출된 데이터가 모두 문자열의 형식이라는 것을 알고 있으며, 우리가 필요로 하는 데이터 형식은 당연히 문자열 형식 하나만 있는 것이 아니다.그래서 우리는 유형 전환이 필요하다!다음...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.