In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to use the code in JSP expressions", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use code in JSP expressions" this article.
The use of "predefined variables" in JSP expressions
To simplify the code in JSP expressions and scriptlets, there are eight automatically defined variables, sometimes called implicit objects (intrinsic objects). They are: request,response,out,session,application,config,pageContext, and page. Let's learn more about them.
Request
Associated with request is the HttpServletRequest class, which allows you to get the parameters of request (through the getParameter method), the type of request (GET,POST,HEAD, etc.), and the incoming HTTP header (cookies,Referer, and so on). Strictly speaking, request is a subclass of the class ServletRequest, not the class HttpServletRequest. In fact, if the protocol of request is not HTTP, then it will hardly work.
Response
The response to the client is connected to HttpServletResponse. Note that because the output stream is buffered, you can set the HTTP status code and the response header, although sending it to the client is not allowed in standard servlets.
Out
The PrintWriter class is used here to send the output to the client. However, to make the response object valid, you can use a buffered version of the PrintWrite class, JspWriter. Using the session property page directive, you can define the size of the buffer yourself, and you can even turn off the buffer after using the buffer attribute. Also note that out is only used in scriptlets, because JSP expressions are automatically put into the output stream, so there is little need to explicitly declare out.
Session
Apply the HttpSession class associated with request. Because session is created automatically, this variable can be bound even without an incoming session. One exception is that if you turn off session with page directive, and then try to use session, it will result in an error (when the JSP page is oriented to servlet conversion).
Application
Use the ServeletContext class, obtained by using getServletConfig (). GetContext ().
Config
Is an object of the ServletConfig class.
PageContext
This is a new class PageContext in JSP that is used to refine the features of a particular server, such as improving the efficiency of JspWriters execution. If you access it through this class instead of directly, your code will still run on the JSP / servlet engine of the rules.
Page
It's not very useful in JAVA JSP expressions, it's just a time to save when the script's language is not JAVA. HTML,scripting elements,directives, and actions.
The above is all the content of the article "how to use Code in JSP expressions". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.