JSP is essentially a servlet, but Tomcat translates it into Servlet,servlet, which is essentially a class, and JSP is also a class. Various tags in the JSP are translated into basic Java code by Tomcat
If a variable is defined in a JSP page, it can be obtained directly from another location, for example
<%string name = "Zhangsan";%><%= name %>
But please note that the current development is not in the JSP to write Java code, the above is Java code, now is the need to use the JSP tag. What is a JSP tag? Here's an example
1.$ tag (el tag)
<%pagecontext.setattribute ("name", "Lisi");%>${name}
Output Result: Lisi
In the JSP want to directly with the El ($) tag need to put the variables in four fields, this time can be directly obtained, this is the El tag rules. The Java code above simply places the variables in the domain and is directly accessible. Four fields, namely
page, request, session, application. The page field is only available in this JSP page, and the request domain can be obtained in one call, and if the request is forwarded on the line, redirection cannot be used. Session represents a conversation,
A session is one that opens a browser, and then it is created. Application is the domain placed on the server, as long as the server is open, this domain can be obtained from anywhere.
Commonly used tags in JSPs