Similar to this question, I cant create a Servlet file with the 'new' context menu New -> Servlet. However, as shown in the screenshot, src/main/java is alreay marked as a source root directory, so its a different problem than the answers suggest.Manually creating a Servlet from a javaclass works, however it would be nice to have the boilerplate code created automatically.
Im following this text tutorial from JetBrains
Screenshot showing the missing of 'new servlet'
Screenshot showing the source root activation
I checked if the Sources root is set correctly and if the default servlet works correctly, which it does.
Newest IntelliJ IDEA versions does not provide the default templates for creating servlets, listeners, and filters. However, you can define these templates yourself.
Paste the following code as the template body:
under
Settings/Preferences | Editor | File and Code TemplatesSee https://www.jetbrains.com/help/idea/creating-and-configuring-web-application-elements.html#elements-templates for more information