How does the GWT client java is converted to a HTML?

余生颓废 提交于 2019-12-22 12:53:13

问题


I'm developing a GWT web app. I write the code in java in client side. But, when I run the app, it appears as a plain HTML page. What is happening when I compile and run a GWT application. i.e. How does the java class gets converted to HTML? and where does this HTML code reside? I could see a lot of html in /war/. But, none were clear enough for me to understand. Could someone help me understand how GWT compilation works? I have read some online articles:

http://code.google.com/webtoolkit/doc/latest/tutorial/compile.html

This says: the html under /war is important for browser specific. But, I'm interested in finding a html which would contain "textbox" for com.google.client.ui.textbox.

Thank you.


回答1:


GWT doesn't compile your classes to HTML, instead it compiles the to JavaScript, which in turns manipulates the DOM tree of your HTML page. In addition to this, the JavaScript generated by the GWT compiler is heavily obfuscated and minified to reduce the size. That's why you never see the actual package names as they are shortened in the generated JavaScript. If you still want to see meaningful output of the compiler you can add

-style PRETTY

OR

-style DETAILED

to the GWT compiler command line (you can find more detail in the docs you've been reading).



来源:https://stackoverflow.com/questions/8221205/how-does-the-gwt-client-java-is-converted-to-a-html

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