1. Download a JBoss-3.2.5 ZIP package on www.jboss.org.
2. Download an example of a struts from www.jarkata.org as a WAR package under Deploy. D: /jboss/server/default/deploy/struts.war
3. Modify D: / jboss / bin in run.bat file set java_home = c: / jdk
4. Find Oracle-DS.xml modifications from D: / JBoss / DOCS / Examples / JCA.
XML Version = "1.0" encoding = "UTF-8"?>
Here Are A Couple of The Possible OCI Configuration, See http://otn.racle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm Clearly, ITS Better to Have TNS Set Up Properly. -> local-tx-datasource> datasources> 5. Place Oracle-DS.xml and place it in D: / JBoss / Server / Default / Deploy 6. Place Oracle Database Driver Classes12.zip into D: / JBoss / Server / Default / LIB 7. Place a new JSP file in d: /jboss/server/default/deploy/struts.war Testlq.jsp.jsp 8. Modify testlq.jsp.jsp <% @ page language = "java"%> <% @ page import = "java.util. *"%> <% @ page import = "javax.sql. *"%> <% @ page import = "java. SQL. * "%> <% @ page import =" javax.naming. * "%>
try {InitialContext ic = new InitialContext (); DataSource dataSource = (DataSource) ic.lookup ( "java: / OracleDS"); Connection dbConnection = dataSource.getConnection (); PreparedStatement pstmt = null; ResultSet result = null; String queryStr = "SELECT OID FROM T_ORDER"; dbConnection = dataSource.getConnection (); pstmt = dbConnection.prepareStatement (queryStr); result = pstmt.executeQuery (); while (result.next ()) {out.println ( "" result. Getlong ("OID"));}}} Catch (Namingexception Ne) {throw new sqlexception ("Naming Exception While" "Up DataSource Connection" ": / N" Ne.getMessage ());}
%> html>
9. Visit http://10.1.101.138/struts/testlq.jsp.jsp