Details
-
Bug
-
Resolution: Fixed
-
Low
-
7.19.19
-
None
-
Severity 3 - Minor
-
Description
Issue Summary
Objects of type com.opensymphony.xwork.util.XWorkList class are inaccessible from Velocity templates.
Steps to Reproduce
- Define a public getter getMyList() on your Action class which returns an XWorkList
- Call that getter and access a list item in your Velocity template using $myList.get(0) or $action.myList.get(0)
Expected Results
Return value displayed
Actual Results
Velocity error logged
Workaround
Define an alternative getter which returns a wrapped delegating instance of the XWorkList.
public class MyAction extends ConfluenceActionSupport { private XWorkList<Type> xworkList; public List<Type> getWrappedList() { return new ListWrapper<>(xworkList); } }
public class ListWrapper<T> implements List<T> { private final List<T> delegate; public ListWrapper(List<T> delegate) { this.delegate = delegate; } // Implement interface methods that call delegate }
then access the wrapped instance in your Velocity template using:
$wrappedList or $action.wrappedList
Attachments
Issue Links
- mentioned in
-
Page Loading...