I have a program which puts out a series of tables, with calls like the following:
out.write(myTableFunction(SourceName, sourceElement, "fieldname", "cname",
new String [] { "errorField" },
new String [] { "Hdr1", "Hdr2", "Hdr3", "Hdr4" },
new String [] { "fld1", "fld2", "fld3", "fld4" },
new int[] { flag1, flag2, flag3, flag4 }
This table has 4 columns, so I pass header text, field name, and processing flag for each column.
It does this for about a dozen tables. Each table call actually covers about 5 lines of code, as you can see. Each table looks like that, but each has a different number of columns, new header text, data fields, etc.
So far, so good.

The problem is that WHICH tables are to be shown changes pretty often.
Rather than touching my main code, I'd love to just break each table call into a separate file, and then (based on a list which I could grab from a configuration file), include just the ones listed, dropping any ones which are no longer on the list.

My first stab was something like this; notice that I'm just trying to include the same file over and over, just to prove the basic concept works. If it did, I would then grab the filename ("fn") from the array pulled from the configuration file.
for (int m = 0; m < 4; m++) {
    String fn = "./myincludefile.jsp";
%><jsp: include '<%= fn %>' /><%
My first approach was to simply put the table code above into a file, and surround it with JSP tags ("<%" and "%>"). That threw compile errors,
when elements weren't defined. So I stuck in the standard includes, and then it complained that the sourceElement variable was not defined in myincludefile.jsp, which is of course true. It's defined in the calling program (master JSP).

It seems like there should be a simple way to just pull the plain code in, as if it were typed there, before the compiler needs to parse it. Maybe there is, but it's escaping me, and Google queries have been defeated by my not being able to find a sufficiently descriptive way of asking the question.

Any ideas? Have I even made the problem clear enough?