myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shaun Campbell <>
Subject Re: Accessing multi level data from within my backing bean.
Date Mon, 13 Jul 2009 15:03:05 GMT
Hi Anton

I've got to the bottom of it.

In my existing working data access code I am using beans defined in Springs
applicationContext.xml and using the Spring simpleJdbcTemplate.

    <bean id="jdbcTemplate"
            <ref bean="dataSource"/>
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName"
value="ants.jdbc.odbc.JdbcOdbcDriver" />
        <property name="url" value="jdbc:odbc:jtj_dsn"/>
        <property name="initialSize" value="5"/>
        <property name="maxActive" value="10" />
<!-- more bean definitions go here -->
    <bean id="jobsBean" class="">
        <property name="dataSource" ref="dataSource" />
        <bean id="jobBean" class="">
        <property name="dataSource" ref="dataSource" />

When I reference jobsBean or jobBean from my web page it knows it's a Spring
bean and injects the jdbcTemplate into it.  In my web page when I access
#{job.ops} job is not recognised as a bean, the template is not injected
into it and the query fails with the null pointer.

What I need is something like this link I have that creates a jobBean, sets
parameters and retrieves the data.

<t:commandLink action="#{jobBean.getJob}" title="#{job.description}" >






Any thoughts as to how I can get around this?  Actually thinking about it
this may be a Spring issue as what I probably need to do is create a jobBean
in my data access code prior to trying to retrieve the data.


View raw message