Without pretty much any exception, you should never access the application scope in a ModelGlue application.
If you are trying to access the default ColdSpring ApplicationConfiguration bean, then treat the javascript file like a normal Model Glue view. This means you need to: - Stick your ApplicationConfig bean in the event. (I often do this in the onRequestStart() method) - Pull ApplicationConfig out of the event in your view. DW On Sun, Jan 22, 2012 at 5:13 PM, 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 -- Plutarch - "The mind is not a vessel to be filled but a fire to be kindled." -- 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
