Bootstrap dojo in Portal Development

 The Dojo bootstrap, dojo.js, should only be included once in an HTML page.

Following way you can create

1. Define one jsp file say dojoLoadedOnce.jsp:
2. Write conditional code as follows
<script type="text/javascript">
 var bootstrap_path = "<%=request.getContextPath() %>/dojo/dojo.js";
 if(typeof dojo=="undefined") {
  document.write('<S');
  document.write('CRIPT type=\"text/javascript\" src=\"');
  document.write(bootstrap_path);
  document.write('\" ><\/S');
  document.write('CRIPT>');
 } 
</script>
3. Like traditional method include this jsp in portal jsp file.

<jsp:include page="/dojoLoadedOnce.jsp" />

This will make sure dojo bootstrap included once in html.

Comments

Popular posts from this blog

Cloud Architecture Notes

Qlik Sense Important Links