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?

4
  • 1
    can you provide me the link of the google docs for this, i want to look into this feature... Commented Mar 1, 2013 at 9: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 plus.google.com/117487419861992917007/posts/Cg9vEE9csXS Commented Mar 1, 2013 at 9: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 <script type="text/java"> in an html page, synthesizes an on-the-fly module entry point, compiles in one second and replaces the script content with the output of the compilation. Unfortunately I don't think such a filter is available, you should ask Ray directly, through the G+ community, or the GWT-contributors group. Commented Apr 1, 2013 at 13:50
  • @Andrea Boscolo .thanks for the information.I'l do that and raise a ticket on G groups too. Commented Apr 6, 2013 at 5:44

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.