Using Servlet with React instead of Velocity!

Hello Atlassian community,

We are currently in the process of developing a Jira plugin using the IDE IntelliJ Community (Edition 2019.3.3) in collaboration with the Atlassian SDK (v8.0.16).
To make things clearer:

  1. We first installed the IDE.
  2. We then followed this Tutorialin order to properly install the Atlassian SDK.
  3. We then proceeded to configure our IDE manually to point to the repository used by the SDK in order to import all the maven dependencies needed.

After that, we created a Servlet that presents a page in Jira using Velocity. In our front-end developping process, we have used React instead of Velocity and it would be double the work if we started using Velocity now. We would like to know how it’s possible to replace the Velocity templates by React ones.

So my question is: How do we replace the Velocity templates with React ones?

Kind regards,
Chaimaa

You could use a single common velocity/soy template with a root div for you to bind the rest of your react to. I’ve used that trick once or twice.

<html>
  <head/>
  <body> 
    <div class="react-root" />
  </body>
</html>
2 Likes

You could also extend the Web Resource Transformer or Web Resource Renderer, feasible, to work more directly with React-style resources. I’m not really sure where to start there though, since Java Nashorn is being deprecated yet most of Atlassian is focused on Java 8 still.

Hello, thanks for replying! Yeah, i’ve decided to use this route to work with React instead of Velocity! Although it’s a little bit complicated and documentation is quite scarce!