This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DWR; javascript files not found

 
Nina Anderson
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nina Anderson
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally got it to work!!! My include path was incorrect.
 
zainu Mehmood
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic