dymanic include in jsp -- is it possible?

I have:

<%@ include file="faq.txt" %>

That works fine. What I would like is for the filename to be variable such as:

<%@ include file=getParameter("faqFile") %>

that doesn't work. Is there a way to do this?
LVL 1
jmarkfoleyAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
u need to use jsp:include for dynamic include

http://java.sun.com/products/jsp/tags/11/syntaxref1112.html

be aware that the two behave differently
0
 
jmarkfoleyAuthor Commented:
OK, that gave *almost* enough detail for my solution. I had to play around a bit but this works:

<jsp:include page="<%=request.getParameter("faqFile")%>" />
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.