http://localhost:9999/webdemo/WEB-INF/classes/servlets/TodayServlet.java
http://localhost:9999/webdemo/today
package servlets; import java.io.IOException; import java.io.PrintWriter; import java.time.LocalDateTime; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @WebServlet("/today") public class TodayServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String now = LocalDateTime.now().toString(); PrintWriter pw = response.getWriter(); pw.println("<h1 style='color:blue'>" + now + "</h1>"); } }
WebServlet
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)