blob: 4ceff5cb6801eb7033283734ba3c137566e575ee [file]
<html>
<head>
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDoNotTrack", true]);
_paq.push(["disableCookies"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.apache.org/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '79']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>Grails Reference</title>
<link rel="stylesheet" href="../../css/ref.css" type="text/css" media="screen" title="Ref" charset="utf-8" />
<link rel="icon" href="../../img/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="../../img/favicon.ico" type="image/x-icon"/>
</head>
<body class="body">
<h1>create-controller </h1><p class="paragraph"/><h2>Purpose</h2><p class="paragraph"/>The <code>create-controller</code> command will create a controller and associated integration test for the given base name.<p class="paragraph"/><h2>Examples</h2><p class="paragraph"/><pre class="bq"><code>
grails create-controller book</code></pre><p class="paragraph"/><h2>Description </h2><p class="paragraph"/>Creates a controller for the given base name. For example for a base name "book" a controller called <code>BookController</code> will be created in the <code>grails-app/controllers</code> directory.<p class="paragraph"/>A controller is responsible for dealing with incoming web request and performing actions such as redirects, rendering views and so on. For more information on controllers refer to the section on <a href="../../guide/single.html#6.1 Controllers" class="guide">Controllers</a><p class="paragraph"/>Note that this command is merely for convenience and you can also create controllers in your favourite text editor or IDE if you choose.<p class="paragraph"/>Usage:
<div class="code"><pre>grails create&#45;controller &#91;name&#93;</pre></div><p class="paragraph"/>Fired Events:
<ul class="star">
<li><code>CreatedFile</code> - When the controller is created</li>
</ul><p class="paragraph"/>
</body>
</html>