Anton Bashmakov
Unregistered
|
|
This article seems good, but I saw some mistakes. First of all there is no symbol "-" in xml tag names. I see extends="jsondefault", but it must be extends="json-default"! I've tried to implement this code, but I get JS error like "servise.methodName() is not a method" It's very sad.
|
Anton Bashmakov
Unregistered
|
|
I made it! It works. 1) Execute method of action must return SUCCESS 2) extends="jsondefault" must be extends="json-default" 3) interceptorref must be interceptor-ref And every thing works fine.
|
Athen
journeyman
Reged: 06/05/07
Posts: 79
Loc: San Francisco, CA
|
|
Thank you for your observations and quick workaround. I'll check in with the author and make the changes in the article itself if he agrees.
-------------------- Athen O'Shea
Editor, JavaWorld.com
|
Oleg Mikheev
Unregistered
|
|
Anton,
Thanks for your comments, they are mostly correct. Dashes disappeared during editorial process, we will put them back asap. But, why did you have to extend Action execute method? The default one returns SUCCESS already, doesn't it?
Oleg
|
Anton Bashmakov
Unregistered
|
|
Yes it is. But it was not in my case. So maybe be you can tell me, Oleg, I have problem with dojo and Struts 2, I know that Dojo is bundled with Struts 2, but I can't do this on my JSP : dojo.require("dojo.widget.Tree"); it fails and I have this in my js console : djConfig.baseScriptUri has no properties. I have <s:head theme="ajax" debug="true"/> on my jsp and suppose that dojo is turned on, but importing Tree widget fails while importing of, say, io.* or rpc.* packages is OK. I need to copy dojo scr's into my application and link jsp to it directly like this : <script type="text/javascript"> var djConfig = { isDebug: true }; </script> <script type="text/javascript" src="org/apache/struts2/static/dojo/dojo.js">/*_*/</script> But I suppose this is not the way as I allready have dojo src's in struts 2 library, and this will not work if there is already <s:head theme="ajax" debug="true"/> defined on the page. What I did wrong?
|
Anton_Bashmakov
stranger
Reged: 09/03/07
Posts: 2
|
|
Yes it is. But it was not in my case. So maybe be you can tell me, Oleg, I have problem with dojo and Struts 2, I know that Dojo is bundled with Struts 2, but I can't do this on my JSP : dojo.require("dojo.widget.Tree"); it fails and I have this in my js console : djConfig.baseScriptUri has no properties. I have <s:head theme="ajax" debug="true"/> on my jsp and suppose that dojo is turned on, but importing Tree widget fails while importing of, say, io.* or rpc.* packages is OK. I need to copy dojo scr's into my application and link jsp to it directly like this : <script type="text/javascript"> var djConfig = { isDebug: true }; </script> <script type="text/javascript" src="org/apache/struts2/static/dojo/dojo.js">/*_*/</script> But I suppose this is not the way as I allready have dojo src's in struts 2 library, and this will not work if there is already <s:head theme="ajax" debug="true"/> defined on the page. What I did wrong?
|
Oleg Mikheev
Unregistered
|
|
Anton,
These kind of questions should be asked on a Struts mailing list. There are lots of Struts developers who might help.
Concerning your question. I've tried to run this JSP in Struts2 application and everything worked with no exceptions: Code:
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="s" uri="/struts-tags" %>
<html> <head> <s:head title="" theme="ajax" debug="false"/> <script type="text/javascript"> dojo.require("dojo.widget.Tree"); </script> </head> <body>test</body> </html>
Does the above code work for you?
|
Unregistered
|
|
Hi I am new to struts 2.
I tried the code provided above but I am getting a javascript error saying "dojo is not defined."
can you please help me resolving the issue.
Thanks in advance. AKP
|