JSP Learning Notes 4

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.

  1. 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.

  2. 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]"/> between jsp:forward pairs.
    -request object packaged the requesting information from client, and the getParameter 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].

  3. 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.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章