cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Request value inside Template file

vesuinfo
Champ in-the-making
Champ in-the-making
Hi All,

I am trying to get "Request value" inside the FreeMarker Template file, but if i try to use  ${RequestParameters['test']}
or ${RequestParameters.test},

Ref Link to get Request value in FreeMarker Template file:
http://forum.springsource.org/archive/index.php/t-32846.html

if i try to use  ${RequestParameters['test']} or ${RequestParameters.test}, I am getting the following error:

        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)
Caused by: freemarker.core.InvalidReferenceException: Expression request is undefined on line 11, column 3 in workspace://SpacesStore/ec431954-2b52-4797-96f6-8469f49ebd78.
        at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
        at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
        at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
        at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
        at freemarker.core.Expression.getStringValue(Expression.java:93)
        at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
        at freemarker.core.Environment.visit(Environment.java:208)
        at freemarker.core.MixedContent.accept(MixedContent.java:92)
        at freemarker.core.Environment.visit(Environment.java:208)
        at freemarker.core.Environment.process(Environment.java:188)
        at freemarker.template.Template.process(Template.java:237)
        at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:202)
        … 88 more

please help me to get the request attributes value in template files ?

Thank you.

Thanks,
Saran
6 REPLIES 6

kbonnet
Champ in-the-making
Champ in-the-making
Maybe you're looking for the "args" array? All url parameters are in there. I guess you searched generic freemarker documentation, but it is embedded in Alfresco, so behaves slightly different.

For example ${args["parametername"]}

Koen

joksy
Champ in-the-making
Champ in-the-making
Maybe you're looking for the "args" array? All url parameters are in there. I guess you searched generic freemarker documentation, but it is embedded in Alfresco, so behaves slightly different.

For example ${args["parametername"]}

Koen
Hi i think is not bound.

kbonnet
Champ in-the-making
Champ in-the-making
I dont understand your reply? What kind of freemarker file are you making? Args is available in webscripts. Maybe not in presentation templates.

joksy
Champ in-the-making
Champ in-the-making
I dont understand your reply? What kind of freemarker file are you making? Args is available in webscripts. Maybe not in presentation templates.

True the only way to get the request parameter is through the webscript. You are able to do that. maybe this post will be useful .
http://forums.alfresco.com/en/viewtopic.php?f=10&t=21044

xauxi99
Champ in-the-making
Champ in-the-making
Marked! I will come back to check this soon!thanks a lot.:-)
demande credit
immobilier simulation pret de france taux calcul
courtier
Une simulation credit immobilier de France
a faire un
pret.
demande
credit immobilier simulation pret de france taux calcul
courtier

vdamodaran
Champ in-the-making
Champ in-the-making
I think you should use the following code to get it work.

If the url is "http://forums.alfresco.com/en/posting.php?mode=reply"
then you have to use the following expression to fix the issue.
${(RequestParameters.mode)!"Default"}