AnsweredAssumed Answered

How to get an URL Paramter from Surf component

Question asked by ridmess on Dec 4, 2009
Hello,

I have a problem to get url paramter, which I used in the Surf Component. When I call the webscript from repositoryhttp://localhost/surf/service/page?f=default&p=NewsDetails&details=test, I get any erro but when I call it from my web site, I get  this error:
500 Description:    An error inside the HTTP server which prevented it from fulfilling the request.

Message:   Failed to process template newsDetails.get.html.ftl
   
Exception:   freemarker.core.InvalidReferenceException - Expression args.details is undefined on line 3, column 3 in newsDetails.get.html.ftl.
Exception:   org.alfresco.web.scripts.WebScriptException - Failed to process template newsDetails.get.html.ftl
   
   org.alfresco.web.scripts.PresentationTemplateProcessor.process(PresentationTemplateProcessor.java:150)
   
Server:   Alfresco Labs v3.0.0 (Stable r13140) schema 2.000
Time:   04.12.2009 12:44:52


the component desc
<component>
   <scope>page</scope>
   <region-id>main</region-id>
   <source-id>testNewsDetails</source-id>      
   <url>/page?f=default&amp;p=testNewsDetails&amp;details={details}</url>
       <!–<url>/newsDetails/{details}</url>–>
</component>

the web script desc:
<webscript>
  <shortname>NewsDetails</shortname>
  <description>Returns the main body of the News page</description>
  <url>/page?f=default&amp;p=testNewsDetails&amp;details={details}</url>
  <!–<url>/newsDetails/{details}</url>  –>
  <transaction>none</transaction>
   <format default="html">extension</format>
   <authentication>user</authentication> 
</webscript>

the web script ftl:
<#if newsliste?exists>

${args.details}
<#else>
      Failed to connect to Alfresco repository.
</#if>

the webscript js:
script:
{
   // get a connector to the Alfresco repository
   var connector = remote.connect("alfresco-system");
   
   var jsonFeed = connector.get("/newsliste/get");

   var obj = eval('(' + jsonFeed + ')');
   
   if (obj)
   {
      var newsliste = obj.newsl;

      model.newsliste = newsliste;
      }


   }

Thanks for your help
ridmess

Outcomes