Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Denied Access in Freemarker Template
Hi,
I am using request.getSession() in freemarker template to set some attribute , It is working in Dev Environment
In QA and Prod It is throwing Errror
Example,
${request.getSession().setAttribute("title", "Title")}
Below Error I am getting
Denied access to method or field setAttribute of class org.apache.catalina.session.StandardSessionFacade
----
FTL stack trace ("~" means
nesting-related):
- Failed at:
${request.getSession().setAttribute(t... [in template
"34393807#34393846#null" at line 59, column 9]
If any one knows please help me.
Thanks.
Q1: Which version?
Q2: Did you compare both
installations' configuration? E.g. Template classes can (and should)
be denied access to most of the underlying runtime environment, and
I'd rather consider this a feature than a problem
General Statement: A freemarker template should not contain any code like this at all. It's meant to create the UI, not store arbitrary stuff in sessions (in fact, nothing should be stored there ever - it hinders load-balancer-fail-overs, eats up your memory, and makes your code unmaintainable)
Powered by Liferay™