servlet

how configure my system to run servlet program

Page 1 of 1

2 Replies - 403 Views - Last Post: 19 March 2009 - 05:52 AM Rate Topic: -----

#1 vinodjavaranjan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-March 09

servlet

Post icon  Posted 19 March 2009 - 12:25 AM

my system has java1.5 and i want to run servlet program. so plz suggest me what setting i have to do and where i will find servlet API
Is This A Good Question/Topic? 0
  • +

Replies To: servlet

#2 majs  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 42
  • Joined: 29-October 08

Re: servlet

Posted 19 March 2009 - 02:25 AM

If you use MyEclipse (not too sure if it's in the standard Eclipse) you can Create a new web project and in the web.xml you can config it to create a servlet based on a class you have created.

In the web.xml you can do the following to define a servlet:

<servlet>
  <description>Description of servlet</description>
  <display-name>Servlet Display Name</display-name>
  <servlet-name>ServletName</servlet-name>
  <servlet-class>com.my.servlet.class.ServletName</servlet-class>
 </servlet>
 <servlet-mapping>
  <servlet-name>ServletName</servlet-name>
  <url-pattern>/servlet/ServletName</url-pattern>
 </servlet-mapping>



Within your servlet class you can get the servlet requests and responses by importing:

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



These imports are from a class which is called javaee.jar, you can find where to download it via the sun website or by searching google.

I understand that whereas this may appear easy via the MyEclipse plugin to Eclipse but in a standalone format you will have to definitely do the leg work shown above of manually setting up the web.xml and making sure the javaee.jar is in your build path.

I hope this helps! :)
Was This Post Helpful? 0
  • +
  • -

#3 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1131
  • View blog
  • Posts: 2,484
  • Joined: 05-May 05

Re: servlet

Posted 19 March 2009 - 05:52 AM

you need the the JDK and tomcat (free open source servlet container) and a tutorial.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1