Hi
when I replace
<#if parameters.nameValue??>
value="<@s.property value="parameters.nameValue"/>"<#rt/>
</#if> with
<#if attributes.name??>
value="<@s.property value="%{attributes.name}"/>"<#rt/>
</#if>
I am getting parameter name displayed in text box but not parameter value
Please help me with this
Thank and Regards
Priyanka
From: Priyanka Vaddadi
Sent: Wednesday, May 28, 2025 6:55 AM
To: [email protected]
Subject: RE: Struts 7.0 issue with Ftl
Hi
When I change below code
<#if parameters.disabled?string?lower_case == "true">
disabled="disabled"<#rt/>
</#if> with
<#if attributes.disabled?string?lower_case == "true">
disabled="disabled"<#rt/>
</#if>
I am getting below error
FreeMarker template error (HTML_DEBUG mode; use RETHROW in production!)
The following has evaluated to null or missing:
==> attributes.disabled [in template "template/wam/text.ftl" at line 51,
column 6]
----
Tip: It's the step after the last dot that caused this error, not those before
it.
----
Tip: If the failing expression is known to legally refer to something that's
sometimes null or missing, either specify a default value like
myOptionalVar!myDefault, or use <#if
myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the
last step of the expression; to cover the whole expression, use parenthesis:
(myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #if attributes.disabled?string?lower_... [in
template "template/wam/text.ftl" at line 51, column 1]
----
Java stack trace (for programmers):
----
freemarker.core.InvalidReferenceException: [... Exception message was already
printed; see it above ...]
at
deployment.wam.war//freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
at
deployment.wam.war//freemarker.core.UnexpectedTypeException.newDescriptionBuilder(UnexpectedTypeException.java:85)
And how do I replace this code which is present in my ftl
<#if parameters.maxlength??>
maxlength="${parameters.maxlength}"<#rt/>
</#if>
I don't see maxLength property in attributes
And when I replace
<#if parameters.nameValue??>
value="<@s.property value="parameters.nameValue"/>"<#rt/>
</#if> with
<#if attributes.name??>
value="<@s.property value="%{attributes.name}"/>"<#rt/>
</#if>
I am getting parameter name displayed in text box but not parameter value
Please help me with this
Thanks and Regards
Priyanka
From: Priyanka Vaddadi
Sent: Tuesday, May 27, 2025 10:54 PM
To: [email protected]<mailto:[email protected]>
Subject: Struts 7.0 issue with Ftl
Hi
I am getting below error while loading the page after migrating to struts 7
Pleaselet me know what could be the issue
Template inclusion failed (for parameter value
"/Empty{name='templateDir'}/simple/checkbox.ftl"):
Template not found for name "Empty{name='templateDir'}/simple/checkbox.ftl".
The name was interpreted by this TemplateLoader:
org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader@6ab4e90c<mailto:org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader@6ab4e90c>.
----
FTL stack trace ("~" means nesting-related):
- Failed at: #include "/${parameters.templateDir}/... [in
template "template/wam/checkbox.ftl" at line 23, column 1]
----
Java stack trace (for programmers):
----
freemarker.core._MiscTemplateException: [... Exception message was already
printed; see it above ...]
at
deployment.wam.war//freemarker.core.Include.accept(Include.java:164)
at
deployment.wam.war//freemarker.core.Environment.visit(Environment.java:344)
at
deployment.wam.war//freemarker.core.Environment.visit(Environment.java:350)
at
deployment.wam.war//freemarker.core.Environment.process(Environment.java:323)
at
deployment.wam.war//freemarker.template.Template.process(Template.java:383)
at
deployment.wam.war//org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:152)
at
deployment.wam.war//org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:595)
at
deployment.wam.war//org.apache.struts2.components.UIBean.end(UIBean.java:554)
at
deployment.wam.war//org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:36)
at
org.apache.jsp.WEB_002dINF.jspf.userRoles_jsp._jspx_meth_s_005fcheckbox_005f0(userRoles_jsp.java:302)
at
org.apache.jsp.WEB_002dINF.jspf.userRoles_jsp._jspx_meth_s_005fiterator_005f0(userRoles_jsp.java:254)
at
org.apache.jsp.WEB_002dINF.jspf.userRoles_jsp._jspService(userRoles_jsp.java:158)
CONFIDENTIALITY NOTICE: This communication with its contents may contain
confidential and/or legally privileged information. It is solely for the use of
the intended recipient(s). Unauthorized interception, review, use or disclosure
is prohibited and may violate applicable laws including the Electronic
Communications Privacy Act. If you are not the intended recipient, please
contact the sender and destroy all copies of the communication.