Archive for March, 2008

spring-mvc configuration

note to myself…..
Lately I was trying to find out how to configure spring’s DispatcherServlet in order to use multiple config files. don’t remember where but I happened to come across with an answer that there is no way to do that. this is completely wrong , at least for spring 2.5 release. Besides, it is very easy… mmmm so I should immediately keep a record of thissss.

in web.xml file

<servlet>
 <servlet-name>myApp</servlet-name>
 <servlet-class>org.springframework.web.servlet.DispatcherServlet
 </servlet-class>
 <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:dbase.xml,classpath:controller.xml</param-value>
 </init-param>
 <load-on-startup>1</load-on-startup>
</servlet>

Comments (1)

json & dojo

After searching through the entire dojo site and documentation finally I found the example about how to pass json object to dojo grid. Actually the solution was in front of my eyes, in the dojox grid examples directory of dojo-1.0.2 release. Here is the solution :
format of the json data must be in this way :

jsonData={ identifier: 'name',  label: 'name',
items: [
{ name:'Nairobi', type:'city' },
{ name:'Mombasa', type:'city' }
]
};
var store = new dojo.data.ItemFileReadStore({data:jsonData});
//to initialize the model object DojoData has to be used, rather than using Table
//query parameter is used to make a query in the given store data. default is also name:'*'.
var myModel = new dojox.grid.data.DojoData(null, store, {
rowsPerPage: 5,
query: {name:'*'}
});
//assuming myGrid object has been initialized with the desired layout
myGrid.setModel(myModel);
myGrid.refresh();

Somehow dojo.data.ItemFileReadStore needs identifier and name parameters in order to parse json data.

Afterall I ‘m not satisfied with the performance of dojo grid. it really takes time to load the libraries and also parsing the json data seems to be time consuming.

Leave a Comment