Wednesday, 26 December 2012

DOJO 1.7 + Spring 3.05 config

fuiyo, masalah pulak dengan Dojo ni.

Hari ini belajar macam mana nak guna static file daripada jar.

Config dalam xxx-servlet.xml
      <!-- Turns on support for mapping requests to Spring MVC @Controller methods   
           Also registers default Formatters and Validators for use across all @Controllers -->  
      <mvc:annotation-driven />  
      <!-- Handles HTTP GET requests for /resources/** by efficiently serving   
           up static resources -->  
      <mvc:resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**" />  

Kemudian import
 <spring:url value="/scripts/dojo-release-1.8.0/dojo/dojo.js" var="dojo_url" />  
 <spring:url value="/scripts/dojo-release-1.8.0/dijit/themes/claro/claro.css" var="claro_url" />  
 <spring:url value="/app/resources/spring/Spring.js" var="spring_url" />  
 <spring:url value="/app/resources/spring/Spring-Dojo.js" var="spring_dojo_url" />  
 <!-- dojo -->  
 <script src="${dojo_url}" type="text/javascript" data-dojo-config="isDebug: true,parseOnLoad: true" />  
 <script src="${spring_url}" type="text/javascript" ><!-- /required for FF3 and Opera --></script>  
 <script src="${spring_dojo_url}" type="text/javascript"><!-- required for FF3 and Opera --></script>  
 <script type="text/javascript">  
      require(["dojo/parser", "dijit/MenuBar", "dijit/MenuBarItem", "dijit/PopupMenuBarItem", "dijit/DropDownMenu", "dijit/MenuItem"]);  

Link /app/resources/spring/ based on setting in current project only.

Dev info:
Codename APR

No comments: