File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes DWR; javascript files not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "DWR; javascript files not found" Watch "DWR; javascript files not found" New topic
Author

DWR; javascript files not found

Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
Hey guys,

I'm new to using DWR. I don't know what I doing wrong...but it looks like the engine.js and util.js files are not being created. And my jsp page failing when it's trying to access the *.js files that DWR is supposed to create.

Here's my jsp code:



Here's my dwr.xml:




Here's my web.xml:




Here's my UploadMonitor.java:





Here's the error I'm getting:

Apr 22, 2008 1:34:37 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
at org.apache.struts.chain.commands.AbstractSelectAction.execute(AbstractSelectAction.java:71)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)


Pls...let me know what I'm doing wrong. I've been struggling with this for days!!!
sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
I hope you are not sumitting the page if using DWR. What i saw is struts coudn't find the action class and if this happends soon after you send the Ajax request throug DWR then you should look at your action in struts and stop returning the sucess from that page, just return NULL in the end and DWR will automatically load response in callBack method.

Hope i am clear and this will help. Let me know if you still have issues.
Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
I was able to solve the issue by changing:

<iframe src="showUploadForm.do" name="addFileFrame" id="addFileFrame" frameborder="0" scrolling='no'></iframe>

to


<iframe src='<html:rewrite action="showUploadForm"/>' name="addFileFrame" id="addFileFrame" frameborder="0" scrolling='no'></iframe>

and it got rid of the Struts Action error.

However, the DWR .js files are still missing. I can't figure out why the /dwr/Engine.js and /dwr/Util.js are not been created.

Pls...HeLP
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

I suspect it's along the same lines as the URL issues you were having with your action. See the JSP FAQ for info on proper addressing of resources.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
When exactly are these .js files generated and how does the application know where to create them?

Maybe when I understand this I'm know where to start debugging, because I'm just clueless and this is just frustrating.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

If I remember how DWR works, the JS files are generated on-the-fly by the DWR servlet.

What happens when you try to type the address of one of the JS files directly in the address bar of the browser?
[ April 23, 2008: Message edited by: Bear Bibeault ]
Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
Bear ....you are the beST!!! I was able to view the generated js files by typing the path on the browser.

Apparently DWRUtil.setValues has deprecated. The new function from util.js is dwr.util.setValues().

However, when I change my jsp to 'dwr.util.setValues()', I'm get a javascript an error stating "'dwr' is undefined". The dwr.util.setValue() is defined in the util.js file, which the source included in my jsp file.

So, I'm wondering why the application can find the 'dwr' object.

Pls...HelP.
Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
I finally got it to work!!! My include path was incorrect.
zainu Mehmood
Ranch Hand

Joined: May 09, 2007
Posts: 45
Nina,Can you please tell me how you managed the include path,i am also getting the same problem that DWR is undefined
Abubacker Siddik
Ranch Hand

Joined: Aug 12, 2009
Posts: 90
Hi all,

Nina Anderson wrote:Bear ....you are the beST!!! I was able to view the generated js files by typing the path on the browser.

Apparently DWRUtil.setValues has deprecated. The new function from util.js is dwr.util.setValues().

However, when I change my jsp to 'dwr.util.setValues()', I'm get a javascript an error stating "'dwr' is undefined". The dwr.util.setValue() is defined in the util.js file, which the source included in my jsp file.

So, I'm wondering why the application can find the 'dwr' object.

Please...HelP.


I encounter a same problem which Nina has said. Can anybody please tell me how to rectify javascript error that dwr is undefined? I can see the generated .js files but when i run it says dwr is undefined. Help me guys.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DWR; javascript files not found