Dynamic Commands
For the previous note, compiler command, the JSP files will be mixed and generate a new servlet file. But the dynamic command, it is going to execute on each time the client requesting.
jsp: forward(no parameter)
-Except page command, clean the code under the page command. Then type<jsp:forward page="[fileName].jsp"></jsp:forward>
. Then when open the index file, it will automatically jump forward to[fileName].jsp
.
-Also the codes which under the forward code won’t be executed.jsp: forward(has parameter)
-Comparing the forward which has no parameter, the hasing one just add one or more<jsp:param value="[value]" name="[name]"/>
betweenjsp:forward
pairs.
-request
object packaged the requesting information from client, and thegetParameter
method is for catching the parameters from the requesting of client.
-the name ofrequest.getParameter("[name]")
is connecting the name of<jsp:param value="[value]" name="[name]"/>
, and the result of the request code is[value]
.jsp: include
-With the different of static commands, dynamic command for include is like<jsp:include page="[fileName].[html]"></jsp:include>
between this pair, you can add<jsp:param value="" name=""/>
to transfer additional parameters.
The content of this blog is summarized from jikexueyuan JSP courses.