Solutions to common DWR3 errors

Source: Internet
Author: User
1. The system prompts "the object is missing"
Cause:
The program uses statements such as dwr. util. setValue ("userInfo", data); or getValues. If the control ID does not match the userInfo name, the system prompts that the object is missing.

Solution:
Check the ID of the control in each setValue to ensure one-to-one correspondence.
If the error still cannot be found, it may be because the control in setValue () cannot bind the result value. You can try it one by one.

2. The message "java. lang. SecurityException: CSRF Security Error" is displayed"
Cause:
Security issues

Solution:
Modify the DWR configuration information in web. xml, add the cross-origin call configuration information (in red), and change it:
<Servlet>
<Servlet-name> dwr-invoker </servlet-name>
<Servlet-class> org. directwebremoting. spring. DwrSpringServlet </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>
<Init-param>
<Param-name> allowScriptTagRemoting </param-name>
<Param-value> true </param-value>
</Init-param>
</Servlet>

3. DWR3 prompts "DWRUtil undefined"
Cause:
DWR2 Bug
Solution:
Add the following statement before calling DWRUtil:
If (typeof window ['dwrutil '] = 'undefined ')
Window. DWRUtil = dwr. util;

4. List class issues of JAVA calls in DWR3
Symptom:
When the method returned by JAVA is of the List type, the following problems may occur:
1. If you pass the dwr/Page test, you cannot obtain the List object.
2. Through the dwr/Page test, you can obtain the List object, but the error message "error" is displayed on the jsp page"
3. display as null undefinable object
Cause:
DWR3 is still not stable enough. After I encountered the above problems, I searched all the methods on the Internet, but the results could not solve the problem. However, I accidentally fixed the problem and restored the previous settings, but no error is reported. After modifying the JAVABEAN class, the WEB server automatically restarts, which should not be a cache issue. If you encounter a similar problem, you can only solve it by division. The solution is as follows.
Solution:
1. Add the property name to be used in dwr. xml
<Allow>
<Create creator = "new" javascript = "UserOK">
<Param name = "class" value = "dwrexam. UserService"/>
</Create>
<Convert match = "dwrexam. UserBean" converter = "bean">
<Param name = "include" value = "userName, userPassword"/>
</Convert>
</Allow>
2. In ModelBean, add constructors without parameters and Parameters
Public UserBean (){

}
Public UserBean (String userName, String userPassword ){
This. userName = userName;
This. userPassword = userPassword;
}
3. Find the latest dwr. jar package. The size of my dwr. jar package on the official website is 1104 kb. However, the dwr. jar package under my code is 1204 kb, and the bigger JAR package solves the problem.
4. re-deploy the project to the WEB, delete the cache files in the WEB server, and under the work directory
5. If the problem persists, restart the computer and let God bless you.

5. An error occurred while calling addRows in DWR3.
Symptom:
The return type must be List type. The following problems may occur:
Data is repeatedly repeated on the webpage. For example, the first field shows AA, the second field shows AABB, and the third field shows AABBCC.
Cause:
DWR3 BUG.
Solution:
I changed the dwr. jar package to the latest one to solve the problem. Dwr. jar is 1104 K in size.

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.