JavaのWebアプリケーション開発フレームワークによる、Webサイト開発の顛末記です。

EclipseのMavenを使った、Spring-MVC、Thymeleaf、MyBatis 等のプログラミングテクニックを、
備忘録的に記録しています。実際に動くソースコードを多用して説明していますので、
これからEclipseや、Spring-MVCを始めたいと思っている人にとって、少しでも参考になれば幸いです。
Spring-MVCの散歩道 > SpringMVC の小径 > 第6歩 Spring-MVC 大きな一歩 > パラメータレスポンス

package jp.dip.arimodoki.cntl;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller //①コントローラ宣言アノテーション
public class Hello {
    /**
     * ②helloマッピングハンドラ
     */
    @RequestMapping(value = "/hello")
     public String hello_view(
         Model model        //④Spring-MVC標準データモデルです。
         ) {

    //⑤データモデルにmynameという変数を"すぷりんぐ太郎"という名前でセットします
    model.addAttribute("myname", "すぷりんぐ太郎");

        //③WebContent/hello.html を描画する
        return "hello";
    }

}