Tomcat is a servlet container, while Weblogic is a J2EE container. The most important thing is that Tomcat cannot be used as an EJB.
JSP is the Java Server Pages. By embedding Java code in a webpage, the dynamic page interaction function is realized. In the J2EE framework, JSP is the core technology of the presentation layer.
A JSP page consists of various elements for dynamic interaction. The elements are divided into five categories:
Annotations, template elements (HTML or XML Code), script elements (Declaration, expression, and script), instruction elements (page commands), and page containing instructions (include ), tag commands (taglib) and Action elements (basic functions of dynamic interactive pages are implemented through a series of standard actions ).
Script element Declaration (the variables and Methods declared on the JSP page ):
<%!
Stringsayhello (){
Return "helloworld !"
}
%>
Expression of the script element (the return value of the output variable or method on the JSP page ):
<% = Sayhello () %>
Script element script (refers to the common Java code embedded into the JSP page ):
<%
Strings = "Hello world !";
Out. pringtln (s );
%>
Command element page commands:
<% @ Page contexttype = "text/html; charset = gb2312">
Command element page contains commands (generally another JSP file ):
<% @ Include file = "header. Jap">
Command element label command:
Use a custom tag at the current location
JavaBean of Action elements:
<JSP: usebean> <JSP: setprooperty> <JSP: getproperty> these three actions are combined to operate JavaBean. Javabean is essentially a Java class related to data operations and is used to encapsulate data operation interfaces.
JSP built-in objects (9 ):
Request, session, application, page: save data in different lifecycles;
Response: indicates the response object;
Config: servlet configuration. You can obtain the initialization data of the servlet configuration from the configuration file (Web. XML;
Out: directly outputs the content;
Exception: When a running exception occurs, go to the specified Error Indication page;
Pagecontext: Manages and obtains the preceding objects, and maintains data as a container.