I would put it at the bottom of your Java Action class code. There is space there to add new code that the executeAction method can access. Put it between the “//BEGIN EXTRA CODE” and “//END EXTRA CODE” comments in the Java Action.
Alternatively, you can create a whole new class and save it in your module’s folder in the javasource directory. Have a look at the Community Commons module. This is the approach it takes.
Good luck!
Hello Audelia,
It's the best practice to create the Java action in Studio Pro and then go to App → Deploy to Eclipse. Then open the project in Eclipse and implement your code. This is the suggested approach. Creating a new class in Java and using that as a utility class in Java action is possible but first creating a Java class and doing reverse engineering is not suggested.
Hope this answers your question.
Hi Audelia! If I understand your question correctly, you already have a Java action generated and used by Mendix and want to create your own class to use in this Java action.
While I haven't found a best practice defined by Mendix, a common method I see used is to create the extra files in the project/javasource/moduleNameOfJavaAction
directory. Just don't forget to export these files as resources with your module export.
Hope this helps!
Create a new java action in Studio Pro and it will write the framework of the java class for you. You just need to fill in the implementation details