Skip to content

Instantly share code, notes, and snippets.

@skmangalam
Created December 16, 2017 16:51
Show Gist options
  • Save skmangalam/f1732155d3ad58e08d9821cf0b589200 to your computer and use it in GitHub Desktop.
Save skmangalam/f1732155d3ad58e08d9821cf0b589200 to your computer and use it in GitHub Desktop.
Spring MVC Hello World
package online.javaguru;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class MyController {
@RequestMapping("/hello")
public ModelAndView helloController() {
ModelAndView model = new ModelAndView();
model.addObject("msg","Welcome to Spring MVC");
model.setViewName("welcome");
return model;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment