GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

Jakarta Servlet

file A Jakarta Servlet, formerly Java Servlet is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web applications on web servers and thus qualify as a server-side servlet web API. Such web servlets are the Java counterpart to other dynamic web content technologies such as PHP and ASP.NET. Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.

file A Jakarta Servlet, formerly Java Servlet is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web applications on web servers and thus qualify as a server-side servlet web API. Such web servlets are the Java counterpart to other dynamic web content technologies such as PHP and ASP.NET. package org.wikipedia.examples; import java.io.IOException; import jakarta.servlet.ServletConfig; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; public class ServletLifeCycleExample extends HttpServlet { private Integer sharedCounter; @Override public void init(final ServletConfig config) throws ServletException { super.init(config); getServletContext().log("init() called"); sharedCounter = 0; } @Override protected void service(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { getServletContext().log("service() called"); int localCounter; synchronized (sharedCounter) { sharedCounter++; localCounter = sharedCounter; } response.getWriter().write("Incrementing the count to " + localCounter); // accessing a local variable response.getWriter().flush(); // flush response } @Override public void destroy() { getServletContext().log("destroy() called"); } }

References

  1. Jakarta Servlet. https://en.wikipedia.org/w/index.php?oldid=1335543657 · 1795438144.7002156
source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"Jakarta Servlet". 1769714364. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1335543657

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·