Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-09-2008, 03:13 AM
Member
 
Join Date: Nov 2007
Posts: 45
sireesha is on a distinguished road
my first servlet
Hi everyone,
i just installed tomcat5.5 in my system.i wrote my first servlet program(.java) like below...
Code:
import javax.servlet.*; import java.io.*; public class servlet1 extends GenericServlet { public void service(Servletrequest req,ServletResponse res) { PrintWriter pw=res.getWriter(); pw.println("Hi,this is my first servlet program."); } }
But when i am trying to compiling this file, i am getting errors like below..
Code:
E:\WINDOWS\servlets>javac servlet1.java servlet1.java:1: package javax.servlet does not exist import javax.servlet.*; ^ servlet1.java:3: cannot resolve symbol symbol : class GenericServlet location: class servlet1 public class servlet1 extends GenericServlet ^ servlet1.java:5: cannot resolve symbol symbol : class Servletrequest location: class servlet1 public void service(Servletrequest req,ServletResponse res) ^ servlet1.java:5: cannot resolve symbol symbol : class ServletResponse location: class servlet1 public void service(Servletrequest req,ServletResponse res) ^ 4 errors
what's wrong with my code...is there any problem with my classpath ?what i have to give for classpath? is it necessary to change any other system variables ?
All other programs which doesn't involve the concept of servlets were compiled fine in my system.
This is the first time i am working with servlets..so i am getting so many doubts..please help me..

Thankq so much.
sireesha.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-10-2008, 12:01 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,532
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Have you try to do it using HttpServlet? Because you can easily throws exceptions and go on.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 27, 2008)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 03-26-2008, 12:43 PM
Member
 
Join Date: Mar 2008
Posts: 13
geeta_ravikanti is on a distinguished road
u copy servlet-api.jar into u r current folder where u r running java proram
and set the classpath like following
set CLASSPATH=servlet-api.jar;.
try and compile
may be its very help ful to u

Geeta
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 04:11 PM
Member
 
Join Date: Apr 2008
Posts: 91
javarishi is on a distinguished road
Yaah this is bcose of servlet library missing.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old Yesterday, 06:54 AM
Member
 
Join Date: Jun 2008
Posts: 13
weiwei is on a distinguished road
新加的空白文章1
这是新加的空白文章1,可以在UBB可视化编辑器中,添加和修改文章内容。
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Servlet vs JSP javaplus Java Servlet 6 06-26-2008 11:19 PM
Regarding Servlet Sudha New To Java 1 02-12-2008 01:44 AM
JSP or Servlet ravian JavaServer Pages (JSP) and JSTL 4 12-03-2007 04:00 PM
How to mix servlet & JSP Swamipsn Java Servlet 1 08-08-2007 01:57 AM
javax.servlet.ServletException: Wrapper cannot find servlet class util.t2 osval Advanced Java 1 08-07-2007 04:47 PM


All times are GMT +3. The time now is 05:56 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org