How to write controller in Java

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 but it seems to incompatible with XP v7.2.0. Is it possible to write controller in Java?
Thank you in advanced!


1.4.0 is compatible with XP7 -, 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 -

1 Like

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

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.


thank you very much!

We (at Item Consulting) have open sourced some libraries that makes it easier to work with TypeScript in Enonic.

  1. enonic-ts-codegen for generating TypeScript interfaces based on XML-files in your enonic project (e.g Content Type)
  2. enonic-types which is typings for the different enonic libraries (e.g. lib-content).
  3. enonic-fp and enonic-wizardry if you are into doing Functional Programming.

Here is a blog post about TypeScript in XP that I wrote to help get started with the libraries.