• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Run Servlet In Eclipse

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hiii....I'm just finish study all tutorial in CodeBarn in this site. At the moment now I want to concentrate on Servlet and JSP. I'm using Eclipse as a tool in writing my code. I'm using this IDE because at my office, java expert using this IDE to do a project.

My question is, anybody know how to Run Servlet in Eclipse. Any body here is expert in Eclipse. Can u explain me step by step to Run the program or u could give me link that teach this thing to me. That's all from me. Tq.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Akmal,

I am going to move this thread to the IDE forum. A Copy will remain in this forum, but will be in a closed state, but anyone can click the link to get to the thread that will be in the IDE forum.

Good Luck

Mark
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well here is the thing. A Servlet, the way it is supposed to be run, needs to run in a Web Server. Which basically means, no to your question.

However, there are other things you can do to "test" your Servlet running through Eclipse.

1. Remote Debugging, have the Servlet run in the Web Server, but have Eclipse hook into the Web Server for Remote Debugging. You can do a search on the JavaRanch Newsletter for remote debugging and find an article on how to set that up.

2. Mock Objects/Unit Tests. Using Mock Objects you can simulate a Web Container and pass fake Request and Response object to see how your Servlet runs.

I suggest both.

Good Luck

Mark
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, if you install the sysdeo Tomcat plugin, Eclipse will start an embedded copy of Tomcat to debug your servlet with. Just set breakpoints, do inspections, etc. just like normal.

The alternative is to deploy to an external servlet container (Tomcat, JBoss, WebWhoever, etc) that has been started with Remote Debugging enabled.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also use the Lomboz plugin ( http://lomboz.objectweb.org/overview.html )

And here an example using OC4J as container:
How To Use Eclipse with Oracle Containers for J2EE (OC4J)

Regards
Tug
 
Akmal Zahdi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well thanks all esp 4 Mark Splitzer(coz for remove my topic here, sorry. dunno that have IDE thread ) , Tim Holloway n Tugdual Grall.

Now I can run my servlet in eclipse after asking help from my staff office. He show me step by step.

The step is :-

1) create tomcat project(I'm using eclipse SDK 3.0.1)

click File at menu bar, File > New > Project > choose Tomcat Project, click Next > give project name, click Next > show Tomcat Project Setting(URL address show on your browser), just click Finish.

2) A tomcat project created show a few files like WEB-INF/src, work, WEB-INF
and some sources TOMCAT. servlet files located in WEB-INF/src.

3) create servlet file in WEB-INF/src file

open folder project that created at 1 step, in that folder you can see 2 folders and 4 files. The folder is WEB-INF and work. click WEB-INF to open it.

4) Create XML Document as a path of servlet into the Browser.

example the document



u just need take care the Bold one, it is a path for servlet.

5) run ur server. Open ur local server home page, then extend it by the like this in ur browser.

localhost/project name/ file name

That's all from me. Tq. I'm writing this just for my refences(make this forum as my notes) and who want to starting learning servlet like me.
 
Akmal Zahdi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry the code project is here



[edited to escape < and >]
[ June 15, 2005: Message edited by: Jeanne Boyarsky ]
 
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Akmal Java",
We're pleased to have you here with us in the IDEs forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. I'm guessing your last name isn't "Java."

Thanks,
Jeanne
IDEs Forum Bartender
[ June 17, 2005: Message edited by: Jeanne Boyarsky ]
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not to hijack this thread, but its related -

I downloaded the WTP plugin and installed it in the Eclipse plugins.
But I can't really fine a J2EE perspective. Not sure what I am missing.

Also, I don't see a 'Tomcat project' (to choose) like mentioned in the above posts.

Any pointes please.
Thanks.

- m
 
Let nothing stop you! Not even this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic