Include JSP file

Source: Internet
Author: User
Tags apache tomcat
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/

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.