Error displaying script config value in webscript
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2014 08:09 AM
Hi all.
I add to my webscript a new script config file "nodeAct.get.config.xml" to use that values in "nodeAct.get.js" and "nodeAct.get.html.ftl".
but when I try to get show the value in the ftl i get the next error:
This is my "nodeAct.get.html.ftl"
this is the error line
And this is the "nodeAct.get.js" where i define the uname variable:
I also try with :
- model.uname =s.nombre;
- model.uname =s.nodeAct.clave;
- model.uname =s.clave;
But i get the same error, and i finally try callin a non xml variable defined ( model.uname=s.notExist
and I get the same error.
I try all defined in https://wiki.alfresco.com/wiki/Web_Scripts#Configuration.
What am i doing wrong??
I'm using alfresco 3.0 if it's relevant.
Thanks a lot in advance
I add to my webscript a new script config file "nodeAct.get.config.xml" to use that values in "nodeAct.get.js" and "nodeAct.get.html.ftl".
but when I try to get show the value in the ftl i get the next error:
500 Description: An error inside the HTTP server which prevented it from fulfilling the request. Message: Wrapped Exception (with status template): 'Error on line 26, column 31 in nodeAct.get.html.ftl Expecting a string, date or number here, Expression uname is instead a freemarker.template.SimpleHash'. Exception: freemarker.core.NonStringException - Error on line 26, column 31 in nodeAct.get.html.ftl Expecting a string, date or number here, Expression uname is instead a freemarker.template.SimpleHash
This is my "nodeAct.get.html.ftl"
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> jQuery.support.cors = true; var urlTicket = "${url.serviceContext}/api/login?u=${user}&pw=${pass}"; var ticket = ""; var request = $.get(urlTicket, function(data,status){ ticket = data.toString().substring(48,95); //window.location.href = "${url.serviceContext}/doAct?nId=${nId}${arguments}&alf_ticket="+ticket; },'html' ); request.error(function(jqXHR, textStatus) { if (textStatus == 'error'){ status.code = 403; status.message = "User not found."; status.redirect = true; } }); </script> <title>Doing actions</title> </head> <body> <div id="error-box" > <br /> <br /><td>nombre= ${uname}</td> </div> </body></html>
this is the error line
<br /><td>nombre= ${uname}</td>
And this is the "nodeAct.get.js" where i define the uname variable:
var s = new XML(config.script); model.uname =s.nodeAct.nombre;
I also try with :
- model.uname =s.nombre;
- model.uname =s.nodeAct.clave;
- model.uname =s.clave;
But i get the same error, and i finally try callin a non xml variable defined ( model.uname=s.notExist

I try all defined in https://wiki.alfresco.com/wiki/Web_Scripts#Configuration.
What am i doing wrong??
I'm using alfresco 3.0 if it's relevant.
Thanks a lot in advance
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2014 03:11 AM
Have you tried :
model.uname =s.nodeAct.nombre.toString();
OR
model.uname =s.nombre.toString();
whichever applicable.
model.uname =s.nodeAct.nombre.toString();
OR
model.uname =s.nombre.toString();
whichever applicable.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2014 04:21 AM
The error was solved, but the result in both cases is "empty" instead of "admin".
This is the "nodeAct.get.config.xml" file content:
This is the "nodeAct.get.config.xml" file content:
<nodeAct> <nombre>admin</nombre> <clave>123123</clave></nodeAct>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2014 06:07 AM
In this case, you should try with "value" :
s.nodeAct.nombre.value.toString();
Try printing the value on console :
What result you get with these :
s.nodeAct.nombre.value;
s.nodeAct.nombre.value.toString();
s.nodeAct.nombre.toString();
s.nodeAct.nombre.value.toString();
Try printing the value on console :
What result you get with these :
s.nodeAct.nombre.value;
s.nodeAct.nombre.value.toString();
s.nodeAct.nombre.toString();
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2014 08:23 AM
On the web page, the result is empty with all posibilities.
I don't know how to show it in the console. I've never used the console with alfresco.
Can you explain how to do it?
Thanks
I don't know how to show it in the console. I've never used the console with alfresco.
Can you explain how to do it?
Thanks
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2014 08:38 AM
You can turn on the logger in alfresco (tomcat\webapps\alfresco\WEB-INF\classes\log4j.properties) and set these properties to debug or info if you want to print values by writing logger.log(value) in your js files.
log4j.logger.org.alfresco.repo.jscript=debug
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug
The same thing applies to alfresco share (tomcat\webapps\share\WEB-INF\classes\log4j.properties).
log4j.logger.org.alfresco.repo.jscript=debug
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug
The same thing applies to alfresco share (tomcat\webapps\share\WEB-INF\classes\log4j.properties).
