Quantcast
Channel: Active questions tagged servlets - Stack Overflow
Viewing all articles
Browse latest Browse all 714

How to update the resource property using the valuemap in the Sling servlet?

$
0
0

I’m getting all the pages,taking the jcr:content of all the pages as resource and trying to update the pageTitle property using valueMap by adapting ValueMap to resource, But I’mgetting UnsupportedOperationException,

Please can anyone help to sort it out,This is my code snippet:

Resource next = resources.next();String path=next.getPath();Resource resource=resourceResolver.getResource(path+"/jcr:content");ValueMap pages = null;if (resource != null) {pages = resource.adaptTo(ValueMap.class);}if(pages != null) {pages.put("pageTitle","MyProject");}

Viewing all articles
Browse latest Browse all 714

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>