The menu for this webpage is at the bottom of every page, click here to go there.

Information Technology (IT) - JSP

IT - JSP

The following are two sample files which specify and comprise a simple servlet for resin, that will put two pet type names into a list and then print the list through the java web server.

resin-3.0.22\webapps\test\WEB-INF\web.xml

resin-3.0.22\webapps\test\WEB-INF\classes\example\TestThree.java


The following is a simple example of a java database servlet:

resin-3.0.22\webapps\test\WEB-INF\classes\example\MySqlOneResin-java.html

The following is a slightly more advanced java database servlet. It fetches specific columns from the database (eg into variables of java types int, float, String). Also the entire 'test2' folder has been made into a "war" (web application archive) file so it is also available as test2.war which can be deployed into the resin database system just by placing the test2.war file in G:\Program Files\Server Applications\resin-3.0.22\webapps\ , when resin finds test2.war it will extract it to G:\Program Files\Server Applications\resin-3.0.22\webapps\test2\WEB-INF\ (including the web.xml file and the MySqlTwoResin.java file into the appropriate directories under test2\WEB-INF\).

The "war" file was created with the command 'jar cvf test2.war WEB-INF' which was run from a cmd.exe window while in the directory G:\Program Files\Server Applications\resin-3.0.22\webapps\test2\

resin-3.0.22\webapps\test2\WEB-INF\classes\example\MySqlTwoResin-java.html
test2-war.zip


To run the java database, place mysql-connector-java-3.1.14-bin.jar in G:\Program Files\Server Applications\resin-3.0.22\webapps\WEB-INF\lib and there's a tip - if resin will not compile it, try running the following batch file, located in resin-3.0.22\webapps\test\WEB-INF\classes\example\ (ie the same folder as the MySqlOneResin.java file):

doCompile.bat

"G:\Program Files\Java\jdk1.5.0_10\bin\javac" -classpath "G:\data\java\classes\mysql-connector-java-3.1.14-bin.jar;G:\Program Files\Server Applications\resin-3.0.22\lib\resin.jar" MySqlOneResin.java
pause
You may need to put C: instead of G: and replace the path shown with your resin path. The data\java\classes is just a place where the JConnector jar file has been stored, it doesn't matter the location (as long as it's specified in the CLASSPATH)

The CLASSPATH used in this example (control panel, system, advanced, environment variables) is:

G:\Data\Java\classes\mysql-connector-java-3.1.14-bin.jar;.


An image showing the java database website being accessed, which illustrates the results of accessing MySqlOneResin.java from the browser, this displays the "user" table of mysql, which for storing usernames and sql command permissions:

Screendump of example mysqloneresin - accessing a mysql database from java using resin web server

MENU

Home
  1. Home
  2. Introduction
3D
  1. Daz Studio
  2. Effect3D Studio
  3. Faceworx
  4. Flare3D
  5. Home Design Suite
  6. IClone4
  7. Three
  8. Various
  9. VRML
  10. WidgetCast
Art
  1. Collaborations
  2. Dogwaffle
  3. Drawing
  4. Drawing (2)
  5. Other
Information Technology (IT)
  1. AIE Game - Animal Farm Antics
  2. ASP.NET Demo
  3. chatPC
  4. Dreamweaver Tutorial
  5. JavaScript Graphics
  6. jQuery
  7. jQueryUI
  8. JSP
  9. Kid Vote
  10. Learning Tutorials
  11. Other
  12. Php Simple Demo
  13. SuperQuadric
  14. Tips
  15. Virtual Reality Language VRJP
  16. WPF Patterns
Music
  1. 2XX
  2. Band In A Box
  3. Chord Composer
  4. Collaborations
  5. Jevan Singing Covers
  6. Creative Rhythmania
  7. Internet Radio
  8. Jazz in Canberra
  9. Jevan singing Karaoke
  10. Jevan Originals
  11. Jevan Piano Jazz
  12. Songs I like
Other
  1. Acting
  2. Blog and Newsletter Archive
  3. Candles
  4. Chat and Social Sites
  5. Contact
  6. Dance
  7. Dating and Friendship
  8. Engineering
  9. Engineering - PSpice
  10. Engineering - Robot Design
  11. Intelligence and Personality Tests
  12. Job Searching
  13. Links
  14. Movie Favourites
  15. Personal History
  16. Ringtones
  17. Scouts
  18. Smileys
  19. Writing
Photos
  1. Best Ones
  2. Panorama
By Jevan Pipitone 2018. You can use or copy any of my material as long as you add a link to the web page http://www.jevan.com.au/