- Output (similar to print)
< % = % >Copy the code
- Adding script snippets (that is, Java code)
The < %int sum=0;
for (int i = 0; i <100 ; i++) {
sum=sum+1;
}
out.println("<h1>"+sum+"</h1>"); % >Copy the code
- Embed HTML (in short, anything that is part of Java code needs <% %>, such as
The < %} % >
)
The < %for (int i = 0; i < 5; i++){
%>
<h1> hello </h1>
<%
}
%>
Copy the code
- Configure the error page in web.xml
<error-page>
<error-code>404</error-code><! -- Error code 404 500,,,,, -->
<location>/error.jsp</location><! The error is the location of the JSP page that needs to be opened.
</error-page>
Copy the code
- Import other JSP pages
<jsp:include page="index.jsp"></ JSP :include> <h1>Copy the code