session trouble
i setting shopping cart app , running issues... in application.cfc, onsessionstart creating object instance of user in session:
<cffunction name="onsessionstart" returntype="void" output="false">
<cfset session.user = createobject("component","user").init()>
</cffunction>
the user.cfc looks this:
<cfcomponent>
<cffunction name="init" access="public" returntype="struct">
<cfset var user = structnew()>
<cfset user.userid="#createuuid()#">
<cfset user.cart = createobject("component", "shoppingcart").init()>
<cfset user.info = createobject("component", "userinfo").init()>
<cfreturn user>
</cffunction>
</cfcomponent>
the shoppingcart.cfc starts this:
<cfcomponent output="false">
<!--- initialize cart’s contents --->
<cffunction name="init" access="public" output="false" returntype="shoppingcart">
<cfset variables.cart = arraynew(1)>
<cfreturn />
</cffunction>
...
and userinfo.cfc starts this:
<cfcomponent>
<cffunction name="init" access="public" output="false" returntype="userinfo">
<cfset variables.info = structnew()>
<cfreturn />
</cffunction>
...
is proper way set up? have gotten intermitant session errors (e.g. "user.info.something undefined java...")
also - there issues/best practices ought aware of arise customers using tabbed browsing or multiple browser instances?
thanks in advance!
andy
<cffunction name="onsessionstart" returntype="void" output="false">
<cfset session.user = createobject("component","user").init()>
</cffunction>
the user.cfc looks this:
<cfcomponent>
<cffunction name="init" access="public" returntype="struct">
<cfset var user = structnew()>
<cfset user.userid="#createuuid()#">
<cfset user.cart = createobject("component", "shoppingcart").init()>
<cfset user.info = createobject("component", "userinfo").init()>
<cfreturn user>
</cffunction>
</cfcomponent>
the shoppingcart.cfc starts this:
<cfcomponent output="false">
<!--- initialize cart’s contents --->
<cffunction name="init" access="public" output="false" returntype="shoppingcart">
<cfset variables.cart = arraynew(1)>
<cfreturn />
</cffunction>
...
and userinfo.cfc starts this:
<cfcomponent>
<cffunction name="init" access="public" output="false" returntype="userinfo">
<cfset variables.info = structnew()>
<cfreturn />
</cffunction>
...
is proper way set up? have gotten intermitant session errors (e.g. "user.info.something undefined java...")
also - there issues/best practices ought aware of arise customers using tabbed browsing or multiple browser instances?
thanks in advance!
andy
just little addition
More discussions in Advanced Techniques
adobe
Comments
Post a Comment