Java Server Pages - The scriptlets
On April 13,2023 by Tom RoutleyA JSP scriptlet is a block of Java code contained between the following tags:
The Java code (which must of course be valid) present between the becomes the body of the _jspService() method when generating the servlet (at least if no directive is indicated).
The scriptlet implicitly has access to many objects. The most widely used objects in scriptlets are:
-The request object: to have the details of the HTTP request (e.g when using forms)
-The out object out to send data to the client browser. For example:
Here is the list of implicitly accessible objects from any scriptlet:
Here is the list of implicitly accessible objects from any scriptlet:
Objet Dérivé de Description request javax.servlet.ServletRequest Objet containing client request response javax.servlet.ServletResponse Object containing the response from the JSP page. This object is used with servlets and is generally not used with JSP, since the HTML is created directly pageContext javax.servlet.jsp.PageContext Object that contains information about the server environment session javax.servlet.http.HttpSession Object containing the current session application javax.servlet.ServletContext Object containing the servlet context out javax.servlet.jsp.JspWriter Object containing the output stream config javax.servlet.ServletConfig Object containing the configuration of the servlet page java.lang.Object Object designating the page itself exception java.lang.Throwable Object representing an uncaught exception
Original document published on CommentcaMarcheet
Article Recommendations
Latest articles
Popular Articles
Archives
- November 2024
- October 2024
- September 2024
- August 2024
- July 2024
- June 2024
- May 2024
- April 2024
- March 2024
- February 2024
- January 2024
- December 2023
- November 2023
- October 2023
- September 2023
- August 2023
- July 2023
- June 2023
- May 2023
- April 2023
- March 2023
- February 2023
- January 2023
- December 2022
- November 2022
- October 2022
- September 2022
- August 2022
- July 2022
- June 2022
- May 2022
- April 2022
- March 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
- January 2021
Leave a Reply