---
title: "dwr2.0实现java改变html的控件属性值"
author: "loveofgod"
date: "2008-05-27T11:59:31Z"
tags: ["DWR", "HTML", "Java"]
slug: "dwr2-0-java-html"
draft: false
lastmod: "2008-05-27T11:59:31Z"
id: 197378
url: "https://akalius.iteye.com/blog/197378"
---

根据dwr官方文档，2.0M2具有了如题的这个属性，但是提供的范例中我们找不到所说的DWRUtil。细细查看，终于在http://getahead.org/dwr/changelog/dwr20上找到了答案，看这行dwr.util (the new name for DWRUtil)，原来改名了。但是这个页面上的范例和目前官方公布的最新版本的包还是有出入的。（我用的版本version: 2.0.rc2 scc-info: $Id: dwr-version.properties,v 1.52 2007/01/04 13:09:20 joe\_walker Exp $） 成功的实现如下： Table.java import org.directwebremoting.WebContext; import org.directwebremoting.WebContextFactory; import org.directwebremoting.proxy.dwr.\*; public class Table { public Table() { super(); // TODO Auto-generated constructor stub } public void newRow(){ WebContext wctx = WebContextFactory.get(); Util utilThis = new Util(wctx.getScriptSession()); utilThis.setStyle("bu","visibility","hidden"); utilThis.setValue("txtUser","testUser2"); } } htm端 这样就OK了！呵呵