/opt/soc/bin/tomcat-setup
Oracle |
||||||
|
Access Oracle database from JSPInstalling TomcatIn your zone, login as root. Next, run the following command: /opt/soc/bin/tomcat-setup The above installs the necessary files for your own instance of Tomcat in 2
setups
Start servicesEnsure that Apache has already been started, you may do so by issuing: svcs apache22 The state should reflect as 'online'. If not, you may start the service by issuing: svcadm enable www:apache22 For extra information, you may stop or restart a service by using the 'disable' or 'restart' command option, such as: svcadm disable www:apache22 svcadm restart www:apache22 svcs tomcat The state should be 'disabled' for www:tomcat, and 'online' for jsp:tomcat.
You may now safely exit from root account. URL for accessing the JSP filesThe base URL of resources served by Apache is: http://<your_zone>/ As mentioned previously, servlets and JSPs are handled by Tomcat, which is stacked behind Apache (the web server front end). So, how does Apache know when to direct servlets and JSP traffic to Tomcat? The answer is in the file httpd-proxy-ajp.conf, which can be found in directory /usr/local/apache/conf/extra/. Search for the lines that have syntax: ProxyPass <path> ajp://localhost:8009/ ProxyPassReverse <path> ajp://localhost:8009/
http://<your_zone>/<path>/will be directed to Tomcat. The default value for <path> is '/WEB-INF'. You may change it to any meaningful name you prefer (e.g. '/jsp'). If a change is made, do remember to restart the Apache service by issuing 'svcadm restart www:apache22' from your root account, or the change will not take effect.
Install Oracle JDBC Driver
Physical location of JSP filesServlets and JSPs served by Tomcat are to be placed in /usr/local/apache-tomcat/webapps/. Each directory in /usr/local/apache-tomcat/webapps/ contains the source codes of a web application.
JSP Sample CodeBefore creating the sample JSP file, make sure you have created the table 'employee' in your Oracle account.
Test out your sample JSP by accessing 'http://<your_zone>/<path>/test/oracle_test.jsp' with a browser.
|
|||||