In this lesson we will learn about the basic technology underneath the Java/Jakarta EE: servlets. Servlets are classes that are instantiated and run on the application server and process HTTP requests at particular URL(s) and produce a response. We will create a couple of servlet applications. first watch this without doing anything: https://www.youtube.com/watch?v=AJxBg90HM4s (small detail: we will not use JSP and we do not need to change run configurations) - register for EDU account on jetbrains - download latest intellij idea ultimate - download glassfish 6.2.3 Jakarta EE Platform - run intellij and create new project java enterprise select project template Web application application server - select new... and enter path to glassfish/bin folder group - enter some package name artifact - enter name of project, i.e. firstservlet project jdk: either select folder with JDK or download NEXT select Version: Jakarta EE 9 keep Servlet 5.0.0 checked in project browser locate src/main/webapp/index.jsp and delete it instead, insert new html file in webapp folder (with right click) and paste the following contents in it: (we do not want to use JSP, we do not need and it is an outdated technology) First servlet

First Servlet


Hello Servlet now you can press the green PLAY button to deploy the app and automatically open a browser, click the link to send request to the servlet study all the various files and folders and their contents in your automatically created project make some trivial modifications to see they apply in the application read this chapter: http://dai.fmph.uniba.sk/courses/java2/jsp/jsp/kap3.pdf (ask for pass on ms teams) optional - you can also read chapter2 here: http://dai.fmph.uniba.sk/courses/java2/glassfish/j7.pdf (same credentials) now task for you: - create a simple calculator servlet, inputs are entered in the form and retrieved as servlet parameters - add a two total sums of calculated results across all requests 1) within the same user session, 2) globally use the servlet attributes for this purpose next: - see homework in LIST more recommended reading: - https://www.developer.com/java/data/exploring-the-servlet-4-0-apis-of-java-ee-8/ - https://portswigger.net/daily-swig/http-3-everything-you-need-to-know-about-the-next-generation-web-protocol for absolute gurus: - https://jakarta.ee/specifications/servlet/5.0/jakarta-servlet-spec-5.0.html