| 
 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 
 | 
 package com.gucci.evalv.controller; 
import java.util.List; 
import org.springframework.stereotype.Controller; 
@Controller 
public class ChattingController { 
    @Autowired 
    private ChatService chatservice; 
    @RequestMapping(value = "chatting") 
    public ModelAndView getFriendList(ModelAndView mv, Member m, HttpSession session, HttpServletRequest request, 
            HttpServletResponse response, String id) { 
        System.out.println("hello?"); 
        id = (String) session.getAttribute("id"); 
        System.out.println("present id" + id); 
        List<Member> list = chatservice.getf_info(id); 
        mv.setViewName("chat/chatmain"); 
        mv.addObject("list", list); 
        mv.addObject("chatroom"); 
        return mv; 
    } 
} 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter 
 | 
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs | 
| 
 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 
52 
53 
54 
 | 
 <%@ page language="java" contentType="text/html; charset=UTF-8" 
    pageEncoding="UTF-8"%> 
<style>img{width: 100px;height:100px;}</style> 
<script> 
    $(document).ready(function() { 
        $.ajax({ 
            url : "chatting", 
            dataType : "json", 
            success : function(data) { 
                var output = ""; 
                $(data).each(function(index, item) { 
                    output += "<div>"; 
                    output += "<p>" + item.address + "</p>"; 
                    output += "</div>"; 
                }) 
                $("#test").html(output); 
            }, 
            error : function() { 
                console.log("ajax로 안와요..."); 
            } 
        }) 
    }) 
    $("#chat").click(function() { 
        location.href = "chatroom"; 
    }) 
    $("#block").click(function() { 
        location.href = "type"; 
    }) 
    $("#f_request").click(function() { 
        location.href = "searchfriend"; 
    }) 
</script> 
test 시작 
<div id="test"></div> 
test 끝 
<c:forEach var="l" items="${list}"> 
    <div id="finfo"> 
    <img src="${l.pic_original}"> 
        <p>${l.id}</p> 
        <br> ${l.address} 
    </div> 
    <div id="f_b"> 
        <input type="button" value="채팅하기" id="chat" /> <input type="button" 
            value="차단하기" id="block" /> 
    </div> 
</c:forEach> 
<input type="button" value="친구 요청 보기 " id="f_request"> 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter 
 | 
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs | 
| 
 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 
 | 
 <%@ page language="java" contentType="text/html; charset=UTF-8" 
    pageEncoding="UTF-8"%> 
<!DOCTYPE html> 
<html> 
<head> 
<meta charset="UTF-8"> 
<title>채팅하기</title> 
</head> 
<body> 
    <button id="frilist">친구 목록</button> 
    <button id="chatlist">채팅방 목록</button> 
    <div id="f_list"> 
    </div> 
    <div id="c_list"> 
    </div> 
    <script> 
        $(document).ready(function() { 
            $("#f_list").css("display", "none"); 
            $("#c_list").css("display", "none"); 
            $("#frilist").click(function() { 
                //location.href= "friendlist"; 
                $("#f_list").show(); 
                $("#c_list").css("display", "none"); 
            }) 
            $("#chatlist").click(function() { 
                $("#f_list").css("display", "none"); 
                $("#c_list").show(); 
            }) 
        }) 
    </script> 
</body> 
</html> 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter 
 | 
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs | 
'IT > SPRING' 카테고리의 다른 글
| [Spring]AOP (0) | 2019.07.04 | 
|---|---|
| AOP 용어 (0) | 2019.07.04 | 
| [Spring] 스프링 계층 구조 (0) | 2019.06.26 | 
| [Spring] 값 보내기 (0) | 2019.06.26 | 
| [SPRING]Spring MVC web.xml에 filter 기능 추가 (0) | 2019.06.21 |