How to write controller in Java


#1

Hi,
I’m a newbie and very happy with XP platform and Javascript API. My concern is, JS is a dynamic type language, it’s hard to maintain in long term. IMHO, I prefer a static type such as Java to write business code. I found https://github.com/enonic/starter-typescript but it seems to incompatible with XP v7.2.0. Is it possible to write controller in Java?
Thank you in advanced!


#2

Hi,

1.4.0 is compatible with XP7 - https://github.com/enonic/starter-typescript/tree/v1.4.0, if not please report a bug on the issue-tab on the github repo.

You should read up on the Java-bridge, a way to write Java-code you can communicate with from your JavaScript controllers - https://developer.enonic.com/docs/xp/stable/framework/java-bridge


#3

thank you, I added a comment in a similar issue in that repo


#4

Typescript starter is obsolete and only maintained for compatibility with pre-XP7 versions.

You should use the Webpack starter instead: it includes code samples in plain Javascript and Typescript (both server- and client-side), transpiled and built with Webpack.


#5

thank you very much!