AnsweredAssumed Answered

Java backed bean not called

Question asked by gbur on Dec 12, 2008
Latest reply on Jan 3, 2009 by pmonks
Hi,

I have a problem with a java backed web script configuration, I use alfresco 3.0

this is my module-context.xml :


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <bean id="webscript.org.alfresco.demo.simple.get"
      class="org.alfresco.module.demoscripts.SimpleWebScript"
      parent="webscript">
    </bean>   

</beans>

the simple.get.desc.xml :

<webscript>
  <shortname>The World's Simplest Webscript</shortname>
  <description>Hands back a little bit of JSON</description>
  <url>/demo/simple</url>
  <authentication>none</authentication>
  <format default="html">argument</format>
</webscript>

Freemarker template

<html>
   ${res}
</html>

Java class

package org.alfresco.module.demoscripts;

import java.util.HashMap;
import java.util.Map;

import org.alfresco.web.scripts.DeclarativeWebScript;
import org.alfresco.web.scripts.WebScriptRequest;
import org.alfresco.web.scripts.WebScriptStatus;

public class SimpleWebScript extends DeclarativeWebScript
{
   @Override
   protected Map<String, Object> executeImpl(WebScriptRequest req, WebScriptStatus status)
    {
      Map<String, Object> model = new HashMap<String, Object>();
      model.put("res", "My result");

      return model;
    }
}

this is the error in th standard Tomcat output :
15:40:01,379 ERROR [freemarker.runtime]

Expression node is undefined on line 2, column 4 in simple.get.html.ftl.
The problematic instruction:
———-
==> ${res} [on line 2, column 4 in simple.get.html.ftl]
———-

what's wrong with my configuration ?

if someone can send me an example of a java backed web script working on Alfresco 3.0 !!

Outcomes