Hi,
I am having some trouble in the following situation. I have a parent child
tag scenario where I am trying to get the value of parameter declared in the
parent tag and use it to do some work in the child tag.
JRun4
jdk 1.4.0
WinXP pro
The jsp syntax looks like so.
<sql:DatabaseMetaData datasource="dsn">
the database is found and an instance of DatabaseMetaData is created
complete with a getter and setter before the child tag runs.
<sql:MetaTables tableNameSchema="types">
I need to use the same instance of DatabaseMetaData declared in
the
parent tag so I don't have to create another connection to the
database.
</sql:MetaTables>
</sql:DatabaseMetaData>
The line of code that is failing is
databaseMetaData = (DatabaseMetaData)
parent.getClass().getField("databaseMetaData").get(java.sql.DatabaseMetaData
);
The error is "cannot resolve symbol class sql". The entire code snippet is
below. Any insight will be appreciated.
Object parent = getParent();
if(parent != null){
try{
databaseMetaData = (DatabaseMetaData)
parent.getClass().getField("databaseMetaData").get(java.sql.DatabaseMetaData
);
}
catch(NoSuchFieldException fe){
throw new JspException("An error occurred attempting to access the
parent tags databaseMetaData field");
}
catch(SecurityException se){
throw new JspException("A security error occurred attempting to access
the parent tags databaseMetaData field");
}
}else{
throw new JspException("cant find the DatabaseMetaData tag");
}
Bryan LaPlante
http://www.netwebapps.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com