1
votes

Since you can post with sling via form with content application/x-www-urlformencoded. This seems to able to create only one node. If my encoded form has child nodes, how should the encoding look?

&./firstnode=value&./secondNode=value

If I want the secondNode to be the child of the first node, what should I do?

2

2 Answers

1
votes

think of all the parameter names as subpaths of the node you're posting to. by default, a single slash would denote a property:

./property=value

to specify a node, you need to set a value under the target node:

./subnode/property=value

i think nt:unstructured is used by default in these cases, but you can explicitly set the nodetype by

./subnode/jcr:primaryType=TYPE&./subnode/property=val&...
-1
votes

ALL nodes that have to be created must be treated independently (counting parent nodes), even if the node is only a parent and doesn't have properties of its own. I am not confident that you can build an entire tree with a single post, because you usually need to save the parent before adding children.

The Sling website has a section on multipart/form-data POSTs for more details.