tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zachary_Roadho...@trilogy.com
Subject Including same file multiple times
Date Sat, 13 May 2000 19:16:32 GMT

I have a complex JSP application that does compile time includes of the
same file in multiple places.
This seems like a perfectly reasonable thing to do, especially if you need
to include a reusable
fragment.  Unfortunately, the Tomcat 3.1 JSP compiler doesn't allow this
behavior.  Instead, it
spits out an error message:

org.apache.jasper.compiler.ParseException: Seen file /WizardErrors.jsp
already, maybe this is a recursive include?!

This message should probably be reduced to a warning.  Is there a log file
for these messages?

Anyway, I patched the registerSourceFile method in JspReader.java to send
the message to
standard error instead.  Is this a reasonable fix?

    protected int registerSourceFile(String file) {
        if (sourceFiles.contains(file)) {

            // ZFR: 5/13/2000, Changed include file behavior to issue a
warning
            // when a file is included multiple times instead of dumping
out with
            // an error.

            String errMsg = Constants.getString
("jsp.error.file.already.registered",new Object[] { file });
            System.err.println(errMsg);

            return sourceFiles.indexOf(file);
            //return -1;
        }
        sourceFiles.addElement(file);
        this.size++;
        return sourceFiles.size()-1;
    }



Mime
View raw message