Your cart
  • IMG
    {{cart_item.name}}
    {{cart_item.variation_attribute_name}}: {{cart_item.variation_attribute_label}}
    {{cart_item.item_unit}}: {{ setCurrency(cart_item.price)}}
    {{ setCurrency(cart_item.price*cart_item.quantity)}}
    Invalid quantity more than stock
Total :
{{setCurrency(cart.sub_total)}}

There is no item in the cart. If you want to buy, Please click here.

Step 3: Create Landing/Home page

Complete Application using Grails 3

Created by :
Grails
tutorial
Programming, Software and application
1090
2020-10-14 16:12:27

For page or any action, we need to create controller at first according to MVC pattern. We can create controller manually (click right button on controller in grails-app> controller , click new then click grails controller and give controller name and click ok) or using grails command as like

grails> create-controller site
 

After than you will see controller as like  

package grailscrud

class SiteController {

    def index() { }

}

Here index() automatically call a view with location views/site/index. So we need to create a view named index.gsp under views/site/index and write something in this view and according to MVC pattern URL for that action will be http://localhost:8080/site/index

If you want to see this page is as default, you have to change in controller/projectname/urlMapping file as like:

static mappings = {

    "/$controller/$action?/$id?(.$format)?"{

        constraints {

            // apply constraints here

        }

    }

    "/"(controller: 'site',action: 'index')

  //  "/"(view:"/index")

    "500"(view:'/error')

    "404"(view:'/notFound')

}