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 04-11-2008, 06:51 AM
Member
 
Join Date: Jan 2008
Posts: 21
banie is on a distinguished road
Servlet
Hi,

I just newbie using java and still learn about using servlet. I implement java source code, seem it direct show the code. And also got those error:

Code:
TestingServlet.java:1: package javax.servlet does not exist import javax.servlet.*; ^ TestingServlet.java:2: package javax.servlet.http does not exist import javax.servlet.http.*; ^ TestingServlet.java:6: cannot find symbol symbol: class HttpServlet public class TestingServlet extends HttpServlet { ^ TestingServlet.java:8: cannot find symbol symbol : class HttpServletRequest location: class TestingServlet public void doGet(HttpServletRequest request, ^ TestingServlet.java:9: cannot find symbol symbol : class HttpServletResponse location: class TestingServlet HttpServletResponse response) ^ TestingServlet.java:10: cannot find symbol symbol : class ServletException location: class TestingServlet throws ServletException, IOException { ^ 6 errors
my code:
Code:
import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class TestingServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("<HTML>"); out.println("<HEAD>"); out.println("<TITLE>Servlet Testing</TITLE>"); out.println("</HEAD>"); out.println("<BODY>"); out.println("Welcome to the Servlet Testing Center"); out.println("</BODY>"); out.println("</HTML>"); } }
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-11-2008, 07:43 AM
sanjeevtarar's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Delhi(India)
Posts: 249
sanjeevtarar is on a distinguished road
Hello,

servlet-api.jar is missing, just add into classpath or put at proper place.



sanjeev
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 07:49 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
I'm not an expert on servlets... but after some searching around, it appears this is a common error when folks don't have their javax.servlet library properly installed or their server on and/or configured. Do a search for "servlet" in the Java Tutorials section of this site.. or just do a basic search for "servlet" and you might just find your answer.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 09:12 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,574
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by CaptainMorgan View Post
don't have their javax.servlet library properly installed or their server on and/or configured.
Yep, I think so. There is a common error message, directed that import package is not perfectly execute.
__________________
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.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-11-2008, 09:47 AM
Member
 
Join Date: Jan 2008
Posts: 21
banie is on a distinguished road
Where to get servlet-api.jar? My geronimo run in /var/geronimo/

You mean add into that directory?
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-11-2008, 09:55 AM
Member
 
Join Date: Apr 2008
Posts: 91
javarishi is on a distinguished road
Which Server Are You Using?, Apache Geronimo? Ok AnyWay This is Freely downloadable. Just Google It. Put It Inside Lib Dir Of Your App.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 04-11-2008, 06:18 PM
Member
 
Join Date: Jan 2008
Posts: 21
banie is on a distinguished road
I'm using Geronimo Apache ver 2.0. If i want to run that servlet, i have to put .class in classes folder, am i right?

But in folder WEB-INF don't have classes file. That mean i have to create it? What else i should do to run that servlet?

Why it show those error when i compile it, before i add in geronimo?

Last edited by banie : 04-11-2008 at 06:20 PM.
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 08:19 PM.


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