1

I'm trying to add a servlet to a web application in Eclipse but I can't because I have to chose a project in the project selection dropdown list and there is no proposal in it :

enter image description here

The finish button stay disabled until a project is selected so I can't add my servlet.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Neo
  • 696
  • 1
  • 14
  • 33
  • Have you already created the project to which you want to add the servlet? Is this project open? – whistling_marmot Jan 24 '16 at 15:01
  • Yes, and i'm trying to add a new servlet bu right clicking on the project folder – Neo Jan 24 '16 at 15:04
  • When you created the project, did you just select 'Java Project'? Or did you select 'Dynamic Web Project'? – whistling_marmot Jan 24 '16 at 15:07
  • You don't have a Java EE project at all (*Dynamic Web Project* for example). Create one, or else simply manually create the servlet via *New Class*. Or, perhaps your GAE project plugin is broken. – BalusC Jan 24 '16 at 15:14
  • Servlets could only be added into projects that are defined as Dynamic Web Project within eclipse, are you sure that's what you opened? – user3687265 Jan 24 '16 at 15:09
  • My project is a google app engine web application – Neo Jan 24 '16 at 15:10
  • Did you open it independentl and imported it into eclispe as an existing project, or did you open it directly from eclipse – user3687265 Jan 24 '16 at 15:11
  • I created it in Eclipse directly – Neo Jan 24 '16 at 15:15
  • So I'm assuming you have the proper google app engine plugin installed?, which version of eclipse are you using, and which plugin version are you using – user3687265 Jan 24 '16 at 15:16

2 Answers2

1

In eclipse, When creating a new project that will contain servlets, you should create a Dynamic Web Project:

create a Dynamic Web Project with the wizard

If you've already created the project, you can right-click / Configure / Convert to Faceted Form / Dynamic Web Module.

whistling_marmot
  • 3,561
  • 3
  • 25
  • 39
1

Right-click on the project, and click 'Properties'. Then open 'Project Facets', and tick the 'Dynamic Web Module' check-box.

enter image description here

After doing this, your project will be available in the Create Servlet wizard.

whistling_marmot
  • 3,561
  • 3
  • 25
  • 39