package com.naba.url.shortner;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class UrlShortnerController {

    @RequestMapping("/greeting")
    public String greeting(@RequestParam(value="name", required = false, defaultValue = "World") String name, Model model) {
        model.addAttribute("name", name);
        return "greeting";
    }
}

package com.naba.url.shortner;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class UrlShortnerController {

    @RequestMapping("/")
    public String landingPage() {
        return "index";
    }

    @RequestMapping("/url-shortner/{url}")
    public String urlShortner(@PathVariable String url, Model model) {
        model.addAttribute("name", url);
        return "gretting";
    }
}

Update controller * Add mapping for index page * Update mapping to url-shortner html page
Update controller
* Add mapping for index page
* Update mapping to url-shortner html page
