0

I am new to GWT. i have Wicket application and want to run GWT application in one of the panels. both are using maven.

  • should i invoke entry point class from GWT in wicket ?
  • how to interact with GWT XML configurations ?

1 Answers1

1

Is it possible to run a regular JavaScript application there? If yes, then please see a modern GWT as Java to JavaScript compiler. No need to deal with any XML or something, you use annotations instead. The new approach is called JsInterop. It's also the way you deal with J2CL (the GWT successor). The mentioned "modern GWT" is about the version 2.8 and above.

So you simply create a JS application using Java. You can use JavaScript frameworks like React or Vue (eg. https://github.com/VueGWT). Finally you compile this to regular JS application. The difference is that it is strongly optimized, you use Java (strong typing), you get benefits from Java related techniques like DI with Dagger2 and so on.

Some references:

  • ty for your answer. yes we can run js in wicket. if i want to export the hole application and somehow call the js file (that jsinterop creates?!) in wicket, how that will happen? – morteza abrari Oct 06 '19 at 09:20
  • the gwt application itself is big project with lot of classes ... – morteza abrari Oct 06 '19 at 09:24
  • If about the way of calling JS app, please see the second link I provided. You have there a simple hello world example: `var aClass = new com.gwt.example.MyClass('World');` `console.log(aClass.sayHello());` More details in both suggested articles, and much more in Google Search... – Marcin Szałomski Oct 07 '19 at 20:13
  • Your comment suggests it is some legacy application. With the "modern GWT", you use compiler only, not GWT Framework itself. You transpile Java code to JavaScript and that's it. Simple. The JsInterop is a mapping only. Like type declarations (typings) for TypeScript. This modern JsInterop approach would be a recommended way for a new application (and minimal GWT version is 2.8 then). Please also note that you may use J2CL instead of GWT compiller now. JsInterop is more or less the same for both (J2CL gives more possibilities and is a future solution). What GWT version does your project use? – Marcin Szałomski Oct 07 '19 at 20:15
  • So from your answer I'm guessing it is a legacy project created with the "old" GWT version and is using legacy approach. JsInterop will not do any magic if your application wasn't build using this solution. At the moment, probably the only way is to try with HTML Iframe and calling the Entry Point from your Wicket template. – Marcin Szałomski Nov 14 '19 at 05:42
  • 1
    i change my approach to solve my problem. tnx anyway :) – morteza abrari Nov 14 '19 at 13:06