Results 1 to 1 of 1
- 12-01-2010, 01:21 AM #1
Member
- Join Date
- May 2010
- Location
- Florida
- Posts
- 68
- Rep Power
- 0
how to run servlet from a real website
Hi
I wrote a servlet and it is working just fine on my tomcat (localhost), I registered for a website with a shared tomcat but I donot know how to run my servlets, I have the following in my website
/public_html/WEB-INF/classes
I read the FAQ of the service provider and I found the following:
I understood most of it but what will I write in the <url-pattern> assuming my servlet is called timeTest, will it be like this ?Servlet Set Up
To setup servlet, you need to configure servlet into the file web.xml which needs to be placed in WEB-INF directory inside your public_html folder.
www root directory or webapps:/public_html
Classes directory located WEB-INF/Classes/
There you will need to upload your Java class file.
Our default url-mapping for servlet is: /servlet/* or /servlets/*
To check servlet in your browser:
www.mydomain.net/servlet/HelloWorld
<url-pattern>/servlet/timeTest</url-pattern>
Right now this is my web.xml file ( I took it from netbeans and changed the url-pattern section).
I am doing it right or I am getting wrong somewhere ?Java Code:<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <servlet-name>timeTest</servlet-name> <servlet-class>timeTest</servlet-class> </servlet> <servlet-mapping> <servlet-name>timeTest</servlet-name> <url-pattern>/servlet/timeTest</url-pattern> </servlet-mapping> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
Any reviews, comments are highly appreciated.
Best Regards.
Anderson.Last edited by mr_anderson; 12-01-2010 at 02:23 AM.
Similar Threads
-
Using a JMenu as a real option
By nfh in forum AWT / SwingReplies: 3Last Post: 11-09-2009, 05:04 PM -
JList – A real confusion.
By darshak_patel in forum AWT / SwingReplies: 8Last Post: 02-07-2009, 12:17 AM -
Need help real bad on 2D array please !
By TrungTran in forum New To JavaReplies: 2Last Post: 11-23-2008, 04:04 AM -
How to download website (Get all link in website)
By finalmem in forum Advanced JavaReplies: 0Last Post: 11-12-2008, 08:43 AM -
real world java
By Zosden in forum Forum LobbyReplies: 6Last Post: 06-25-2008, 05:39 AM


LinkBack URL
About LinkBacks

Bookmarks