How to write(enable) Java code in HTML while using GWT 2.5?

点点圈 提交于 2019-12-04 16:29:32

问题


I've started taking advantage of GWT 2.5. The coolest feature of GWT 2.5 was the ability to write Java code directly in our HTML pages like so:

<script type="text/java">
   String helloWorld = "Hello world";
   Window.alert(helloWorld);
</script>

The trick is to use a ServletFilter on the server side. This ServletFilter uses the GWT compiler to compile this java code into Javascript and inject it into the HTML returned to the client.

I am unable to figure out how to filter this in web.xml or how to pass information to the compiler. How can I do this?


回答1:


Here is the Google I/O 2012 - The History and Future of Google Web Toolkit you are referring too. And here are the slides posted by Ray Cromwell.



来源:https://stackoverflow.com/questions/15144145/how-to-writeenable-java-code-in-html-while-using-gwt-2-5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!