DWR Error: Object does not support this property or method

Source: Internet
Author: User
Tags csrf attack

A JavaScript error occurred while running HelloWorld

"Error: Object does not support this property or method"

In IE browser http://localhost:8000/Struts_Dwr/dwr/test/service can appear SayHelloWorld ();

can also run

The results of the operation are:

SayHelloWorld (); "Hello worldwanxuesi!"

But running with JavaScript in a JSP will report the above error, why.

The JSP code is as follows:

<%@ page language= "java" pageencoding= "UTF-8"%>

<title>my JSP ' first_dwr.jsp ' starting page</title>
<script type= ' text/javascript ' src= ' dwr/interface/service.js ' ></script>
<script type= ' text/javascript ' src= ' js/engine.js ' ></script>
<script type= ' text/javascript ' src= ' js/util.js ' ></script>
<script type= "Text/javascript" >
function Firstdwr () {
Service.sayhello ("Jorwen", Callbackhello);
}
function Callbackhello (data) {
alert (data);
}
</script>
<body>
<input type= "button" name= "button" value= "Test" onclick= "Firstdwr ()" >
</body>

Solution:

To download a dwr.jar on the Internet if 2.0, size 494k, this problem will not occur.

But there is another problem (Eclipse console):

2007-11-19 13:22:52 org.directwebremoting.util.CommonsLoggingOutput Error
Serious: A request has been denied as a potential CSRF attack.

As long as in

In the Web.xml configuration file ...
Configuration of Dwr


<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>
<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
</servlet>

At this point, the console appears normal. But the JS script will also complain:

Error: Exception was thrown and not caught.

Not to be continued. Co-study.

Then I put the original Dwr.jar a new cover. Okay, everything's fine, it's unbelievable. Finally, I can get started.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.