它们是我将javascript嵌入GWT代码的一种方式吗?

它们是我将javascript嵌入GWT代码的一种方式吗?,javascript,html,gwt,Javascript,Html,Gwt,最终HTML状态hhtml=newHTML(“,true) statushHTML.setHTML(结果) //结果我传递了字符串 1. result = <b> bold </b> // it displays bold 2. result = <i> italics </i> // it works 3. result = <font color='red'> red </font> // it works again 4. result = <h1> h1

最终HTML状态hhtml=newHTML(“,true)

statushHTML.setHTML(结果)

//结果我传递了字符串

1. result = <b> bold </b> // it displays bold 2. result = <i> italics </i> // it works 3. result = <font color='red'> red </font> // it works again 4. result = <h1> h1 tag </h1> // this also works fine But if i try 5. result = <script> alert('No output') </script> // now it doesn't work It's just displaying it in string format. 1.结果=<b>粗体</b>//它显示粗体 2.结果=<i>斜体</i>//它可以工作 3.结果=<font color='red'>red</font>//它再次工作 4.result=<h1>h1标记</h1>//这也可以正常工作 但是如果我尝试 5.结果=<script>alert('No output')</script>//现在它不工作了 它只是以字符串格式显示。
如果需要插入脚本,请使用

示例代码:

String script = "alert('No output')";
ScriptInjector.fromString(script).inject();

我试图从客户端发送一个rpc调用,并以字符串的形式从服务器端返回响应,但它读取的是另一个标记,而不是脚本标记,我尝试使用Adam告诉我的ScriptInjector,但我收到以下错误:com.google.gwt.user.server.rpc.UnexpectedException:Service方法'public abstract java.lang.String com.customer.phone.client.CustomerService.userValidation(java.lang.String)抛出java.lang.IllegalArgumentException“抛出意外异常:java.lang.NoClassDefFoundError:无法初始化类com.google.gwt.core.client.ScriptInjector是否需要更改方法??