Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Problem with servlet
M Zabidin Mamat
Greenhorn
Posts: 5
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I still newbie with
servlet
. Need help and also some advice. Here is my 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>"); } }
But got this kind of error:
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
Does that mean package not available in API
doc
?
Ben Souther
Sheriff
Posts: 13411
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
See:
http://faq.javaranch.com/java/CompilingServlets
Java API
J2EE API
Servlet Spec
JSP Spec
How to ask a question...
Simple Servlet Examples
jsonf
Ben Souther
Sheriff
Posts: 13411
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I'm going to move this to our
Java
in General forum where classpath, and javac issues are handled.
Java API
J2EE API
Servlet Spec
JSP Spec
How to ask a question...
Simple Servlet Examples
jsonf
M Zabidin Mamat
Greenhorn
Posts: 5
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I still confuse why i can't compile that file. If i want to use that file, i have to make it to .class, am i right?
Ulf Dittmer
Rancher
Posts: 43081
77
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Did you read and understand the FAQ entry Ben pointed you to? The first part -that talks about the servlet jar file being needed- is exactly what your problem is.
M Zabidin Mamat
Greenhorn
Posts: 5
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yes, i read that faq. Maybe i need more study about this.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
java don't compile my servlet.
servlet will not compile aargh
SimpleServlet.java:2: package javax.servlet does not exist
compilation error while running simple servlet code
error with compiling servlet
More...