spring
for문 별찍기
index
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <html> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.util.*, java.text.*"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <head> <title>메인 페이지</title> </head> <body> <%=new Date()%><!-- 갱신이 안되고있을때를 확인하기 위해서 --> <h2>Hello World</h2> <a href = "t1">링크1</a><br> <a href = "t3">링크3</a><br> <a href = "t4?nickname=apple">링크4</a><br> <a href = "t5?nickname=apple&salary=300">링크5</a><br> <a href = "t5?nickname=banana&salary=400">링크6</a><br> </body> </html> | cs |
tiger
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | package Pack01; 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 Tiger { @RequestMapping("t1") String func01() { System.out.println("들어왔음"); return "TigerView"; } @RequestMapping("t3") String func03() { System.out.println("라이언 들어왔음"); return "LionView"; } /*@RequestMapping("t4") String func04(String nickname) { //String func04(@RequestParam(value = "nickname") String nickname) //String func04(@RequestParam(value = "nickname") String s) System.out.println(nickname); return "LionView"; }*/ @RequestMapping("t4") String func04(String nickname) { System.out.println(nickname); return "LionView"; } /*@RequestMapping("t5") String func05( @RequestParam(value = "nickname")String nickname, @RequestParam(value = "salary")int salary ) { System.out.println(nickname+salary); return "LionView"; }*/ @RequestMapping("t5") String func05(String nickname, int salary) { System.out.println(nickname+salary); return "LionView"; } @RequestMapping("t6") String func06(Model model,String nickname, int salary) { model.addAttribute("k1", "dog"); System.out.println("k2"+salary); return "LionView"; } } | cs |
728x90
'비트 장기 > jsp' 카테고리의 다른 글
8/18 복습17일꺼 보충 mvc넘어가는거 알기 (0) | 2018.08.19 |
---|---|
8/18 mvc (0) | 2018.08.18 |
8/16 (out,) (0) | 2018.08.16 |
8/14 복습(count쓰는법? rs.next()) (0) | 2018.08.16 |
8/13 복습 (0) | 2018.08.14 |
댓글