Generate-Controller

Is it possible to generate a controller for an existing domain class from within IDEA? If so, how? I can see the generate views option at the top of the page when I have the domain class open in the editor and I see the Controller name listed there but I do not get a Generate Controller option. I've tried right clicking, left clicking, double clicking. I'm sure I'm missing something obvious but I'm stumped. I am preparing for Grails presentation for a user group and I really want to use IDEA for this but it would be awkward to have to jump out to the shell to generate controllers.

IndigoCard Login

0
1 comment

Hy there i can see your post and i must say

 

In IntelliJ IDEA, you can indeed generate a controller for an existing domain class in a Grails project. Here's how you can do it:

  1. Open the Domain Class: Open the domain class for which you want to generate a controller in the editor.

  2. Generate Controller: In the editor where the domain class is open, you will see a "Generate Views" option at the top of the page. Click on the dropdown arrow next to it.

  3. Select Controller: From the dropdown menu, you should see the name of the controller associated with the domain class. Click on the controller name.

  4. Generate Options: A dialog will pop up asking you to choose the methods to generate for the controller. You can choose actions like create, edit, show, update, delete, etc. Select the actions you want to generate methods for. MyAARPMedicare

  5. Confirm: After selecting the actions, click the "OK" or "Generate" button. IntelliJ IDEA will then generate the controller code for you based on the selected actions.

Thanks and regards

 

0

Please sign in to leave a comment.