This code is not real, but is simpler and show the problem
Suppose that I have First File named Base.jsp
<%!
class Base {
public String Parm0 = "";
public String Parm1 = "";
Base () {
PrintMessage("Base Created!!");
}
}
javax.servlet.jsp.JspWriter Out;
void SetJspWriter(javax.servlet.jsp.JspWriter out) {
Out = out;
}
void PrintMessage(String Msg) {
try {
Out.print("<P style=\"color:rgb(255,0,0)\">"+Msg+"</P>");
}
catch (Exception e) {}
}
%>
Now I have a Second File that use the base file: Fil0.jsp
<%@ include file="Base.jsp" %>
<%!
class File0 {
public Base MyBase;
File0 () {
MyBase = new Base();
PrintMessage("Based Used!!");
}
}
%>
Now I have a Third File that use the base file: Fil1.jsp
<%@ include file="Base.jsp" %>
<%@ include file="Fil0.jsp" %>
<%!
class File1 {
public Base MyBase;
public File0 MyFil0;
File1 () {
MyBase = new Base();
MyFil0 = new File0();
PrintMessage("Based and Fil0 Created!!");
}
}
%>
<%
SetJspWriter(out);
File1 MyFil1 = new File1();
%>
As you can see... this code will produce messages like:
Duplicate field Fil1_jsp.Out
Duplicate method PrintMessage(String) in type Fil1_jsp
How solve this error Before I need to include Base in two files: File0 and File1. And File1 have Base and File0...
The compiler find two declarations...