My output should be something like this:
<result>
<item>
<id>123</id>
<src>123</src>
<dst>123</dst>
</item>
<item>
<!-- ... -->
</item>
</result>
And the action class would have a method getFoos
which returns an array of uniform objects, e. g. like this:
class Foo {
// ...
public long getId() { ... }
// ...
}
I'm using the XSLTResult like this:
<action name="channels" method="loadAll" class="com.econemon.suite.api.impl.FooAction">
<result name="success" type="xslt">
<param name="exposedValue">foos</param>
</result>
</action>
Since I don't want to postprocess the XML, I didn't specify any template, after reading several tutorials that said this would work. Instead, it gives me this error:
javax.xml.transform.TransformerException: Operation not supported. - [unknown location]
So I tried using a template, but it never rendered a list at all. Instead I get
- all properties of the beans
toString()
ed together - empty document
- empty
<foo />
tag (not<foos />
, strangely)
I couldn't find a tutorial that helped me, neither on Beans->XML rendering nor XSLT. One problem is that I have trouble coming up with good search terms: googling "struts xml" and similar returns a huge amount of completely irrelevant links about stuff in struts.xml
, excluding "struts.xml" from the results is no good either, because pages I'm looking for would likely have example struts.xml snippets.
I think I wouldn't really need the templates, so if it's possible to do without, great.