This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Page tag for File include Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Page tag for File include" Watch "Page tag for File include" New topic

Page tag for File include

Salmany Yasser

Joined: Sep 09, 2003
Posts: 1
I want to include JSP file in the main JSP using this tag, the problem is I get a translation error at compilation time when using a String variable containing the file name instead of using explicit physical file name.
is ther any solution for this problem to get a generic page that can includes many files according to parameter sent from the servlet ?
this works perfectly :
<%@ include file="file_name.jsp" %>
this generates JSP translate not found :
<%@ include file=" <%= variable_name %>" %>
Faisal Khan
Ranch Hand

Joined: Jun 29, 2003
Posts: 285
Originally posted by Salmany Yasser:
<%@ include file=" <%= variable_name %>" %>

You can not user real time expressions with the include file command, you will have to use the following:
<jsp:include page="<%=variable_name%>" />

The secret to creativity is knowing how to hide your sources.
Consider Paul's rocket mass heater.
subject: Page tag for File include
Similar Threads
problem with tag file
How can I consolidate some duplicate JSTL code in my JSP?
custom link tags
Help in using jsp:include tag
problem with both jsp: include and %@include tags