PDA

View Full Version : Can Mondrian parse JSP inside a query tag?



coolguy982
06-16-2003, 09:58 AM
We are receiving errors when trying to run the following code snippet in our query...
<%@ page session="true" contentType="text/html; charset=ISO-8859-1" %>
<%@ taglib uri="
http://www.tonbeller.com/jpivot/mondrian
" prefix="mondrian" %>
<jsp:useBean id="loginHandler" class="com.LoginBean" scope="session"/>
<mondrian:query id="query01"
jdbcDriver="oracle.jdbc.driver.OracleDriver"
jdbcUrl="jdbc:oracle:thin:@servre:1521:DB"
jdbcUser= "<%= loginHandler.getUsername() %>"
jdbcPassword= "<%= loginHandler.getPassword() %>"
catalogUri="/WEB-INF/queries/DataMine.xml">
Our errors come when trying to call the Bean for the jdbcUser and jdbcPassword. Is this the correct syntax to do this or must the username/password be hard coded?
Thanks.
P.S. We know LoginBean works properly because we are using it on another application in much the same manner.

jhyde
06-17-2003, 10:42 PM
Hmm, I'm not an expert on JSP, but it seems like it should work. Take a look at the Java file generated by the JSP compiler and see if it looks reasonable. You could also try assigning loginHandler.getUsername() and loginHandler.getPassword() to a local variable just before invoking the <mondrian:query/> tag.

coolguy982
06-18-2003, 02:35 AM
I've tried the following code but it still does not work. It is as if Mondrian doesn't let the JSP compile what is in the query tags. The java line created by the JSP is:
_jspx_th_partrader_query_0.setJdbcDriver("<%= driver %>");
This should be the actual driver name, not the jsp code <%= driver %>.
Here's the code I'm running (Don't pay attention to the user and password attributes on this one, I'm just testing the driver name):
<%
System.out.println("I'm printing from the jsp query!!"); //this works
String driver = "oracle.jdbc.driver.OracleDriver";
%>
<mondrian:query id="query01" jdbcDriver='<%= driver %>' jdbcUrl="jdbc:oracle:thin:@server:1521:DB" jdbcUser="user" jdbcPassword="password" catalogUri="/WEB-INF/queries/mondrian.xml">
And the error:
com.tonbeller.jpivot.olap.model.OlapException: Could not load Jdbc Driver <%= driver %>
at com.tonbeller.jpivot.mondrian.MondrianModel.getResult(MondrianModel.java:88)
at com.tonbeller.jpivot.olap.model.OlapModelDecorator.getResult(OlapModelDecorator.java:34)
at com.tonbeller.jpivot.olap.model.CachingOlapModel.getResult(CachingOlapModel.java:36)
at com.tonbeller.jpivot.olap.model.OlapModelDecorator.getResult(OlapModelDecorator.java:34)
at com.tonbeller.jpivot.table.TableComponent.render2(TableComponent.java:151)

coolguy982
06-18-2003, 10:13 AM
Disregard the last post. We were able to achieve what we needed by rewriting the MondrianOlapModelTag.java file and calling our LoginBean.java file.