Results 1 to 7 of 7
Thread: Servlet
- 04-11-2008, 05:51 AM #1
Member
- Join Date
- Jan 2008
- Posts
- 21
- Rep Power
- 0
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:
my code:Java 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
Java 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>"); } }
- 04-11-2008, 06:43 AM #2
Hello,
servlet-api.jar is missing, just add into classpath or put at proper place.
sanjeev
- 04-11-2008, 06:49 AM #3
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.
Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice? Vote now!
Got a little Capt'n in you? (drink responsibly)
- 04-11-2008, 08:12 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 04-11-2008, 08:47 AM #5
Member
- Join Date
- Jan 2008
- Posts
- 21
- Rep Power
- 0
Where to get servlet-api.jar? My geronimo run in /var/geronimo/
You mean add into that directory?
- 04-11-2008, 08:55 AM #6
Member
- Join Date
- Apr 2008
- Posts
- 91
- Rep Power
- 0
Which Server Are You Using?, Apache Geronimo? Ok AnyWay This is Freely downloadable. Just Google It. Put It Inside Lib Dir Of Your App.
- 04-11-2008, 05:18 PM #7
Member
- Join Date
- Jan 2008
- Posts
- 21
- Rep Power
- 0
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 05:20 PM.
Similar Threads
-
Servlet vs JSP
By javaplus in forum Java ServletReplies: 5Last Post: 06-26-2008, 10:19 PM -
Regarding Servlet
By Sudha in forum New To JavaReplies: 1Last Post: 02-12-2008, 12:44 AM -
JSP or Servlet
By ravian in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 12-03-2007, 03:00 PM -
How to mix servlet & JSP
By Swamipsn in forum Java ServletReplies: 1Last Post: 08-08-2007, 12:57 AM -
javax.servlet.ServletException: Wrapper cannot find servlet class util.t2
By osval in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 03:47 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks