how to run a servlet in Eclipse

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rahana
    New Member
    • Oct 2007
    • 12

    how to run a servlet in Eclipse

    Hello Friends

    How can i run my servlets in Eclipse 3.2,i am able 2 run servlets without using Eclipse ie simply cerating the hirerarchy and using tomcat5 and internet explorer.

    In Eclipse how can i place web.xml and what type of url do i need to use in browser.

    Thanking you
    Rahana
  • ajos
    Contributor
    • Aug 2007
    • 283

    #2
    Originally posted by rahana
    Hello Friends

    How can i run my servlets in Eclipse 3.2,i am able 2 run servlets without using Eclipse ie simply cerating the hirerarchy and using tomcat5 and internet explorer.

    In Eclipse how can i place web.xml and what type of url do i need to use in browser.

    Thanking you
    Rahana
    Do something like this--->
    Code:
    <servlet>
    		<description>
    		</description>
    		<display-name>
    		Hello</display-name>
    		<servlet-name>Hello</servlet-name>
    		<servlet-class>
    		testing.Hello</servlet-class>
    	</servlet>
    <servlet-mapping>
    		<servlet-name>Hello</servlet-name>
    		<url-pattern>/Hello</url-pattern>
    	</servlet-mapping>
    Hello is the name of the servlet class


    Ideally the web.xml should reside in the WEB-INF folder.
    If you are using eclipse, you dont have to type the path in the browser yourself, therz an option in web.xml
    Code:
    <welcome-file-list>
    		<welcome-file>index.html</welcome-file>
    		<welcome-file>index.htm</welcome-file>
    where say index.html is your view that you have created.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Install WTP (the Web Tool Platform). It's an extension for Eclipse and
      does a whole lot of administrative and other stuff for you.

      kind regards,

      Jos

      Comment

      Working...