Two methods are available for JSP files:
1. jsp include pseudocommands, such as: <% @ include file = "footer. jsp" %> cannot be dynamically called using variables?
2. jsp: Include tag, for example, <JSP: Include page = "<% = test %>" Flush = "true"/> can dynamically include files. Let's test this.
Test code: Apache Tomcat/5.5.4 win2000
Test. jsp
<%
String body = request. getparameter ("test ")
%>
<JSP: Include page = "<% = test %>" Flush = "true"/>
Hi. jsp
<%
Out. Print ("Hi, jeck ");
%>
We submit:
Http: // localhost/jspshell/test. jsp? Test = Hi. jsp
Hi.jspsuccessfully executes the output hi,jeck. now we change hi.jspto hi.txt and submit:
Http: // localhost/jspshell/test. jsp? Test10000hi.txt
The image store does not have any output. we press the right button to check that the original code has the hi.txtcode, and hi.txt is not executed.
Remote File: Submit http: // localhost/jspshell/test. jsp? Test = http: // xxx/X. jsp
This is also not acceptable.
Summary:
Use of JSP dynamic inclusion files:
1. Execute the local. jsp file [the suffix cannot be txt or other, and other parts are not tested :)]
2. Cooperate with./or./violent File Content
3. remote files cannot be used.
Refer:
Http://www-128.ibm.com/developerworks/cn/java/j-jsp04293/