Eclipse only needs two things to do this:
One
In Eclipse, Window β Settings β Server β Workspace
Specify your web server or application server path by adding "New Server Runtime."
Update
Initially, only a few Runtime runtime environments are available in Eclipse:
As an additional note, you can add additional server adapters using the Download additional server adapters adapters link Download additional server adapters dialog box.

Two
In the project properties (right-click on the project β properties) in the Java build path, add the "Server Runtime" library.
When adding server runtime to the project library, the servlet-api.jar and jsp-api.jar banks will be added to the project dependencies.

source share