Spring boot and Open UI5 error : JSON.parse: unexpected end of data – when setting resourceroots

Problem : After setting the tag data-sap-ui-resourceroots the UI5 loading stops with the error “JSON.parse: unexpected end of data …”

Reason : Spring boot thymeleaf view formatter changes single quotes to double quotes, thus braking the valid JSON format of the tag.

    <script src="/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_belize" data-sap-ui-libs="sap.m" data-sap-ui-compatVersion="edge" data-sap-ui-preload="async" data-sap-ui-resourceroots="{"demo":"uidemo"}">
<!-- note the stupid double quotes in the json at the end of above line -->
<!-- this was originally single quotes - '{"demo":"uidemo"}' -->

Fix :  

  • Make the landing page a static HTML instead of a view template (move from templates folder to static, in Spring boot).
  • OR
  • Move to Velocity or JSP formatters

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

45,334 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>