---
title: "DWRUtil未定义解决"
author: "liyanhui"
date: "2009-05-22T16:11:48Z"
tags: []
slug: "dwrutil"
draft: false
lastmod: "2009-05-22T16:11:48Z"
id: 393526
url: "https://liyanhui.iteye.com/blog/393526"
---

转自：[http://www.iteye.com/topic/371958](http://www.iteye.com/topic/371958)

jsp:  
&lt;script type='text/javascript'&gt;  
                function hello() {  
                var user = $('user').value;  
                alert(user);  
                    Hello.hello(user, callback);  
                }  
                function callback(msg) {  
                alert(msg);  
                   DWRUtil.setValue('result', msg);  
                }  
&lt;/script&gt;

下载的dwr3,一直提示DWRUtil未定义,添加xalan.jar也不好使

解决办法:在DWRUtil.setValue('result', msg);前加入

if (typeof window\['DWRUtil'] == 'undefined')  
                      window.DWRUtil = dwr.util;  
(发现别人早已解决)