Hi list, i've just started playing with CS and so for so good.  I''ve
got the following (constructor) code setup for a category method
(bean?):

        <cffunction name="init" access="public" output="false">
                <cfargument name="categoryDAO" type="model.categoryDAO" 
required="yes"/>
                        <cfset variables.categoryDAO = arguments.categoryDAO />
                <cfreturn this />
        </cffunction>

but i've seen the following, which seems to make more sense but i
can't figure out how to pass in the beanFactory

<cffunction name="init" access="public" output="false">
                <cfargument name="serviceFactory"
type="coldspring.beans.BeanFactory" required="yes"/>
                <cfset variables.checkUser = 
arguments.serviceFactory.getBean('checkUser')/>
                <cfreturn this />
        </cffunction>

using this init method generate an error " The parameter
SERVICEFACTORY to function init is required but was not passed in.:" -
which makes sense?

XML:
<!-- category service -->
        <bean id="categoryDAO" class="model.categoryDAO">
                <constructor-arg
name="datasourcename"><value>${datasourceName}</value></constructor-arg>
        </bean>
        <bean id="categoryService" class="model.categoryService">
                <constructor-arg name="categoryDAO">
                        <ref bean="categoryDAO"/>
                </constructor-arg>
        </bean>

What am i missing and which is better practice?

TIA
--
Nick Tong

web:         http://talkwebsolutions.co.uk
blog:         http://succor.co.uk
f..works:    http://cfframeworks.com
short urls:  http://wapurl.co.uk
green link: http://wapurl.co.uk/?4Z2YDLX
co.uk/?4Z2YDLX

Reply via email to