Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

new to servlets, need help !

 
Kapil Sakhuja
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
i am new to Servlets and i have made a very simple servlet as follows :

import java.io.*;
import javax.servlet.*;
class serv extends GenericServlet
{
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<B> this is servlet speaking </B>");
pw.close();
}
}
After compiling the above code as given in a book i saved the
'class file' in 'c:\jsdk2.0\examples' and started the 'servletrunner' but when i try to access it through InternetExplorer, i get the message 'page not found'. On the DOS prompt also, where the 'servletrunner' is running, i get message that the servlet could not be found.If it is related to properties file, kindly explain.
plzzzzzzzzz help !!!
 
Dharmesh Chheda
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey
i am replying but me never used servletrunner still you can try
if you have stored your class file TrialServlet.class in any directory let us assume c:\abcd\efgh then you have to start the servlet runner by entering
servletrunner -d c:\abcd\efgh
and then in the browser give the url
http://localhost:8080/servlet/TrialServlet


------------------
IBM Certified WebSphere Application Server V3.5 Specialist
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic