Skip to content

Instantly share code, notes, and snippets.

@ageldama
Created January 16, 2013 16:51
Show Gist options
  • Select an option

  • Save ageldama/4548749 to your computer and use it in GitHub Desktop.

Select an option

Save ageldama/4548749 to your computer and use it in GitHub Desktop.
Spring Web MVC Example.
@Controller
public class CalcController {
@RequestMapping("/")
public void welcomeHandler() {
}
@RequestMapping("/plus")
public ModelMap plus(Integer a, Integer b) {
ModelMap m = new ModelMap();
// JSP에서 표시할 내용들을 바인딩.
m.put("a", a);
m.put("b", b);
m.put("result", a + b); // a+b=?
return m;
}
}
${a} + ${b} = <b>${result}</b>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment