Spring's Web Application and Dojo
Hello,
I am trying build web applications using Spring and Dojo, I'm using the "<mvc:resources/>" element in the spring's configuration.
I have the next problem, when I use "dijit.byId('idelement')" I get an error message:
1. "dijit.byId is not a function" in Firefox 5.0 with Firebug
2. "Uncaught TypeError: Object #<Object> has no method 'byId'" in Chrome 12
My questions are:
1. Is possible use spring 3 and dojo independently (in a no intrusive way)? that is, use in one application but each with its own syntax.
2. How I cant solve those error messages?
3. Does it apply the same settings for Spring MVC 3 and Spring Web Flow 2?
I hope someone can help me.
Thanks and regards,
Friend Solve it like This
is is not solved yet.?
following tags enter to your web.xml
Code:
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jpeg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.gif</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.png</url-pattern>
</servlet-mapping>
you know how to load data to dojo grid.?
if you know please let me explain about it.
thanks & regards
Solved (SpringMVC+Roo+Dojo)
Ok, I have managed to resolve my issue, not really sure why it's set-up this way, but here it goes.
I had the same issue as the poster. I also had the added issue of misused require:
HTML Code:
dojo.require(["dojo/parser"]);
Which boils down to be wrong, and I combined, incorrectly two ways of doing this which is described here:
http://livedocs.dojotoolkit.org/dojo/require
In my case I did (note the "/" is replaced by "." and "[,]" are gone too:
HTML Code:
dojo.require("dojo.parser");
Now, I was back to square one. My dojo widgets weren't being parsed.
So after some digging I found that Roo's automatic Spring MVC configuration uses the following line:
HTML Code:
<script type="text/javascript">var djConfig = {parseOnLoad: false, isDebug: false, locale: '${fn:toLowerCase(userLocale)}'};</script>
Now, this disables Dojo's parsing. Once you set:
parseOnLoad: true
Everything started working.
Now, why is that value disabled by default? I would like to know.
Also, I can't seem to disable that value and use something like:
Code:
dojo.addOnLoad(function() {
dojo.parser.parse(dojo.byId("myDiv"));
}
Any thoughts?
One more thing about the parser...
Ok today I am on a roll on answering my own questions, and asking new ones. Hopefully this will be helpful for those running into similar issues.
Ok, so the parseOnLoad: false is to force you to control the way your page loads. Better explained here:
http://acuriousanimal.com/blog/2010/...oader-in-dojo/
Now, I just need to figure out how to get the parser to work in this configuration. I just can't get it to work, whenever I try to do something like:
Code:
dojo.addOnLoad(function() {
dojo.parser.parse(dojo.byId("myDiv"));
}
I end up with:
Uncaught SyntaxError: Unexpected end of input
But the page loaded correctly...
What gives?