AnsweredAssumed Answered

How to access Spring bean from javascript webscript

Question asked by sorin_postelnicu on Apr 1, 2016
Latest reply on Jun 10, 2016 by steven.okennedy
Hello all!

Maybe this is a simple question, but I couldn't find any answer in Google:
How can I access a Spring bean from a javascript webscript running in a WebQuickstart application?

I have tried this (which is working in the Share javascript console):
  var ctx = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
  var myBean= ctx.getBean("myBean");
but it's not working in my WCMQS javascript webscript, it says: "org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined."

What is the alfresco javascript syntax for accessing the Spring context?

Thanks!

Outcomes