15

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?

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
  • 1
    can you provide me the link of the google docs for this, i want to look into this feature... – JAVAC Mar 01 '13 at 09:34
  • Unable to find the Google doc for that.Lets hope someone will give a solution or link regarding that .I started it by reading https://plus.google.com/117487419861992917007/posts/Cg9vEE9csXS – Suresh Atta Mar 01 '13 at 09:44
  • 1
    I actually don't think this is an out of the box feature, but only to show what `SuperDevMode` and `Elemental` can do together, by simply code a `ServletFilter` that catches every ` – Andrea Boscolo Apr 01 '13 at 13:50
  • @Andrea Boscolo .thanks for the information.I'l do that and raise a ticket on G groups too. – Suresh Atta Apr 06 '13 at 05:44

1 Answers1

2

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.

Adrian B.
  • 4,333
  • 1
  • 24
  • 38
  • Thanks Adrian for the valuable links.But there I didn't get how to use the above feature there.Only explanation about the feature is there. – Suresh Atta Mar 12 '13 at 15:49