I would place your ApplicationConfig, i18nService and any other bean you
want to access externally in a parent bean factory, create this in your
Application.cfc's onApplicationStart method and set it into the application
scope.  The tell ModelGlue to use this as a parent to its internal bean
factory.  You do this in your ModelGlue app's index.cfm by setting   <cfset
ModelGlue_PARENT_BEAN_FACTORY = application.whereverYouPutYourBeanFactory />

Chris

On 22 January 2012 22:13, marc <[email protected]> wrote:

> Hi,
>
> I have a javascript file: /includes/js/login.js.cfm that I include in the
> login page of my Model-Glue application:
>
>     <head>
>         <script type="text/javascript"
> src="/includes/js/login.js.cfm"></script>
>         [....]
>     </head>
>
> Inside file login.js.cfm I want to access the default ColdSpring
> ApplicationConfiguration bean:
>
> <cfset
> loginTimeOut=Application["#application.applicationName#"].getBean("ApplicationConfiguration").getConfigSetting("LoginTimespan")>
> <cfset
> loginTimeOutMessage=Application["#application.applicationName#"].getBean("i18nService").getText("message_loginTimeOutMessage")>
>
> In my development environment this works: I get to the Model-Glue
> framework and can access method getBean().
>
> in my production (shared hosting) environment it does not work:
> application.applicationName resolves to "CMS" but there is no
> Application["CMS"] key so I get an CF error page instead of a nice
> Javascript include.
>
> Application.cfc and Coldspring.xml files are identical in production and
> development. Only in these 2 files the Application name gets set. I would
> think that if this.name in Application.cfc's is set to "CMS", I should
> have a key "CMS" in Applicationscope everywhere in my application, right?
>
> Apparently this is not true.
>
> But In production there is a Application._modelglue key that contains the
> Model-Glue framework. So if I do
>
> <cfset
> loginTimeOut=Application._modelglue.getBean("ApplicationConfiguration").getConfigSetting("LoginTimespan")>
> <cfset
> loginTimeOutMessage=Application._modelglue.getBean("i18nService").getText("message_loginTimeOutMessage")>
>
> everything works fine there, but not in my development environment since
> there is no key Application._modelglue there
>
> So my question is:
>
> How can I access Model-Glue (or the bean I'm after here) in a file that's
> not "in the framework" as in this case?
>
> Thanks,
>
> Marc
>
> --
> Model-Glue Sites:
> Home Page: http://www.model-glue.com
> Documentation: http://docs.model-glue.com
> Bug Tracker: http://bugs.model-glue.com
> Blog: http://www.model-glue.com/blog
>
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/model-glue?hl=en

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to