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

2019-03-24 11:07发布

问题:

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.



标签: java gwt gwt-2.5