// shall I write some keywords here to boost search engine ranking?

Friday, November 04, 2005

Include Page Dynamically in JSP

<jsp:include page="<%= url %>" flush="true" />
<%@ include file="<%= url %>" %>

Ever think of include a dynamic page with method above where 'url' is a String of page to include? This will sure end with dissapiontment cause it doesn't work in JSP (and ASP as well).

However, JSP have the 3rd way to include a page:
<% pageContext.include(url); %>

Maybe this is not good practice to have lots of Java code within JSP. So if you have any better ways, please share it with me. Thank you. :)

1 comment:

Chin Tat said...

actually the first way also can work if u use single quote(') instead of double quote(").

http://javaalmanac.com/egs/javax.servlet.jsp/include.jsp.html?l=new