How to run Java servlet application in embedded tomcat 10 0 22

preview_player
Показать описание
#embeddedtomcat #tomcat #servlet #runservletinsideembeddedtomcat #javaweb #simplejavaweb
How to run Java servlet application in embedded tomcat 10.0.22
Prerequisite
1. your laptop already install maven
2. Your laptop already installed intellij Idea/ other IDEA
3. your laptop have internet connection

what will we do?
1. Create java web/java servlet using maven
2. Create servlet class to handle simple request from client
3. run the application inside embedded tomcat and build it into the jar file
for example

Let's jump right in
1. create web application using maven
2. create java folder
4. define tomcat version
5. add assembly plugin, to build java web/servlet into jar
6. define resource directory
- define port, host, contextpath
- annotation scanning
- Add the JAR/folder containing this class to PreResources
8. create simple servlet
9. BUILD app to jar using this command (mvn clean compile assembly:single)
10. find jar which already build
12. try to run this url (localhost:8080/employee)

Succed, happy learning and happy sharing!!!
Рекомендации по теме
Комментарии
Автор

Very useful and clear steps, Thanks alot.

moathwafeeq
Автор

do you need to install maven in our laptop ? defining maven compiler plugins wont work ?

abhishekmaahraz
visit shbcf.ru