File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes DWR  Undefined Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "DWR  Undefined" Watch "DWR  Undefined" New topic
Author

DWR Undefined

chetan raj
Ranch Hand

Joined: Jul 18, 2006
Posts: 34
I am trying to run the dwr sample example. gettting the following error dwr undefined.
I have places dwr.jar in my lib folder of the tomcat.
Can any body suggest where i am going wrong. Any link to dwr examples will be
really helpful

thanks in advance,
chetan raj

This is my code
Demo.jsp
<html>
<head>
<script>
function update() {
var name = dwr.util.getValue("demoName");
Demo1.sayHello(name, function(data) {
dwr.util.setValue("demoReply", data);
});
}
</script>
</head>
<script language="text/javascript" src="/js/engine.js"></script>
<script language="text/javascript" src="/js/util.js"></script>
<script language="text/javascript" src="/js/gi.js"></script>


Name:
<input type="text" id="demoName"/>
<input value="Send" type="button" onclick="update()"/>


Reply: <span id="demoReply"></span>



______________________________________________________________
Demo1.java
public class Demo1{
public String sayHello(String name) {
return "Hello, " + name;
}
}
___________________________________________________________________
web.xml

<web-app>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dw/*</url-pattern>
</servlet-mapping>

</web-app>
------------------------------------------------------------------------------------------

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

Also, since DWR has both server and client side components, it's more of a framework than a JavaScript library, so it's probably best to discuss it in the Frameworks forum. I've moved this post there for you (though to be honest, I do not know if there are many DWR devotees who frequent these forums).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Just where do you get this message? From JavaScript? From the Java compiler? Please tell the details!

Are you sure that your servlet mapping is correct? It looks suspect to me.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: DWR Undefined
 
Similar Threads
JSP with DWR.XML
DWR error
DWR; javascript files not found
Struts-JSP Application
DWR unable to include js file