-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
9.0.3
-
Severity 3 - Minor
-
-
RtB - Service ops & Tech entropy
Issue Summary
The contributing factors to this bug have not yet been isolated. Please refer to the reproduction steps below.
Steps to Reproduce
In General:
- Create a plugin
- Define a Struts Action which maps to a Velocity Result
- Define a getter method on Action class whose name ends with 'html' and returns a String
- Have the Velocity template render a Soy template, where the 'value' parameter is obtained from the aforementioned method
#set($templateParameters = { "type": "textarea", "labelContent": "$i18n.getText('user.macro.template')", "name": "userMacro.template", "id": "userMacro_template", "value": $!action.templateHtml, "rows": "20", "cols": "80", "extraFieldClasses": "max-textarea", "description": "$i18n.getText('user.macro.template.desc', [$docBean.getLink('help.user.macro.templates')])", "required": "$i18n.getText('required.field')"}) $soyTemplateRendererHelper.getRenderedTemplateHtml("com.atlassian.auiplugin:aui-experimental-soy-templates", "aui.form.field.soy", $templateParameters)
- Browse to the Action and trigger rendering of template
OR
In Confluence Core codebase:
- Edit confluence-core/confluence-webapp/src/main/webapp/admin/macros/usermacro-form.vm
- Replace $!templateHtml with $!action.templateHtml
- Visit /admin/addusermacro-start.action
Expected Results
A form input field whose default value is the String returned by the previously defined method.
Actual Results
Expected value is prepended by
{annotationCollection: [{}], annotations: [{}], collectionInheritableAnnotations: [{}], declaredAnnotations: [{}], description: Annotated value:
and appended by
; Annotations: [@com.atlassian.velocity.htmlsafe.HtmlSafe()]}
Workaround
Instead of passing the value using:
$action.methodNameHtml
Use the OGNL shortcut:
$methodNameHtml
- is related to
-
CONFSERVER-97879 Using the foreach directive with a context item that is blocked by the Introspector in a Velocity template will throw an unhandled exception
-
- Closed
-
-
CONFSERVER-97514 Methods beginning with 'render' or 'getRender' that return a non-String type, will throw an exception when invoked from a Velocity template
-
- Gathering Impact
-