<servlet> <servlet-name>fetch</servlet-name> <servlet-class>javaranch.EmployeeServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>fetch</servlet-name> <url-pattern>/test</url-pattern> </servlet-mapping> </web-app> I HAVE USED ACCESS DATA BASE DSN NAME--emp data base name---any- dsn name matters--only table name---people_table ID--NUMBER FNAME--TEXT LNAME--TEXT DEPARTMENT---TEXT EMAIL--TEXT IMAGE---TEXT-----consists the url's for the images /webAppPrefix/sample.gif Add some records in the people_table
dir structure: webAppPreFix/WEB-INF/web.xml webAppPreFix/WEB-INF/classes/javaranch/both the classes here(servlet/bean) webAppPreFix/arch/all jsp pages here. webAppPreFix/yourImage
type in your browser: ..../webAppPrefix/test or ...../webAppPrefix/test?cmd=get&id=1 Clients should not be able access the jsp pages directly,to implement this (security)click here
Its a very simple application but we can add different functionalities to improve it. (update,add,delete) SETTING TOMCAT (WINDOWS 2000) my jdk1.3 is installation directory d:\jdk1.3 tomcat installation directory is ---tomcat d:\tomcat >controlpanel>system>Advanced>Environment Variables>system variables>New---type CLASSPATH in the upper textfield and the value in the lower textfield .;d:\tomcat\common\lib\servlet.jar HERE tomcat is the name of tomcat installation directory. ok next set the path: PATH ----upper textfield d:\jdk1.3\bin ----value in lower tf. next set catalina_home: CATALINA_HOME ----upper tf d:\tomcat ---value lower tf. HERE tomcat is the name of tomcat installation directory.
set java_home: JAVA_HOME ----upper tf d:\jdk1.3 ----lower tf OR/and Edit setclasspath.batch file located at tomcat>bin>setclasspath.batch: here set java_home like this: set JAVA_HOME=d:\jdk1.3 This batch file looks like this: rem --------------------------------------------------------------------------- rem Set CLASSPATH and Java options rem rem $Id: setclasspath.bat,v 1.8 2003/01/17 10:07:21 remm Exp $ rem --------------------------------------------------------------------------- rem Make sure prerequisite environment variables are set if not "%JAVA_HOME%" == "" goto gotJavaHome set JAVA_HOME=d:\jdk1.3 <---------------------------------------------HERE :gotJavaHome if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome goto okJavaHome
------------------------------------------------------- To confirm your settings type: http://localhost:8080/ Enter u should get the default tomcat home page. I hope it helps! [ August 05, 2003: Message edited by: Amer Khan ]
<i>Dare to dream - everything that exists today,was once a figment of someone's imagination, nobody says tomorrow can't be a figment of your today.</i>
Amer Khan
Ranch Hand
Joined: Apr 05, 2003
Posts: 163
posted
0
means p param
means :and odbc Suggestions to improve or to add more functionality are more than welcome.
Sophia Choi
Ranch Hand
Joined: Mar 22, 2002
Posts: 106
posted
0
I follow your programs under same directory.But the web.xml can't be found. 2003-06-05 11:47:40 WebappLoader[/WebAppPrefix]: Deploying class repositories to work directory D:\Tomcat 4.1\work\Standalone\localhost\WebAppPrefix 2003-06-05 11:47:40 WebappLoader[/WebAppPrefix]: Reloading checks are enabled for this Context 2003-06-05 11:47:40 ContextConfig[/WebAppPrefix]: Missing application web.xml, using defaults only Thanks for helping.
Amer Khan
Ranch Hand
Joined: Apr 05, 2003
Posts: 163
posted
0
correct location of web.xml: webAppPreFix/WEB-INF/web.xml
Not
webAppPreFix/WEB_INF/web.xml
Amer Khan
Ranch Hand
Joined: Apr 05, 2003
Posts: 163
posted
0
Hi Sophia,
Did u add these line at the begining of the web.xml. <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> Instead of cluttering your Tomcat installation directory a better approach is to keep your webapplication under your working directory.Consider D:\myDir as your working directory. create the following structure in your working directory (myDir). 1)webapplicationPrefix(this is your application name)FOLDER, in this folder create 'arch' Folder and 'WEB-INF' FOLDER in the WEB-INF FOLDER create 'classes' FOLDER. 1,put your web.xml in the WEB-INF folder 2,put your jsp pages in arch folder. 3,your bean and servlet go in classes folder. 4.keep your images in webapplicationPrefix folder Open the %TOMCAT_HOME%\conf\server.xml if your tomcats server.xml has a<ContextManager>--</ContextManager> block.Add the the following entry just before the closing </ContextManager> tag OR some where here<!-- Tomcat Root Context --> in server.xml. <Context path="/webapplicationPrefix docBase="D:\muDir\webapplicationPrefix" debug="0" /> Tomcat inspects content of this directory at server startup. Rember webapplicationPrefix is the name of your application. Here the first attribute is the path pointing to your webapplicationPrefix.This is the same as the path in the URL.The second attribute is a docBase attribute pointing to where your application is located.So like this u can have your application located anywhere on the system.(out-side tomcat installation dir).
Sophia Choi
Ranch Hand
Joined: Mar 22, 2002
Posts: 106
posted
0
Thanks Amer, it is working right now.
Engin Okucu
Ranch Hand
Joined: Feb 09, 2002
Posts: 174
posted
0
Hi Amer, Thanks for you apllication. It's easy to read, the most important thing that i appreciated. I tried it,it works well.
Verity smith
Greenhorn
Joined: May 27, 2003
Posts: 18
posted
0
Hi,
Amer thanks for the application ,can anyone add some more functionality.It will be a great help.