1. Include actions/ include directives
Include directive syntax: <%@ include file= "URL"%>
Include action syntax: <jsp:include page= "URL" flush= "true | False "></jsp:include>
The difference between include actions and include directives:
|
Include directives |
Include action |
Syntax format |
<%@ include file= "URL"%> |
<jsp:include page= "URL" flush= "true | False "/> |
Time to take effect |
During page conversion |
Request Period |
Include content |
The actual contents of the file |
Output of the page |
Convert to Servlet |
The main page and the Include page are converted into a servlet |
The main page and the included page are converted into separate Serlvet |
Compile time |
Slower (resources must be parsed) |
More quickly |
Execution time |
More quickly |
Slower (each resource must be parsed) |
2.forward action/Same forward effect code
Forward action syntax: <jsp:forward page= "URL" ></jsp:forward>
Same effect code: request.getrequestdispatcher ("/url"). Forward (ServletRequest req,servletresponse res);
3.param Action
param action Syntax: <jsp:param name= "parameter name" value= "argument value"/>
Xforward Action + param action
Format:
<jsp:forward page= "URL" >
<jsp:param name= "paramname" value= "Paramvalue"/>
</jsp:forward>
JSP (Java Server Page) JSP directives and action elements