Dorothy_YANG
With Dorothy
Dorothy_YANG
전체 방문자
오늘
어제
  • 분류 전체보기 (279)
    • Hi, I'm Dorothy 🕵️‍♂️ (21)
      • Slowly but Surely (18)
      • IT certifications (3)
    • 🤯TIL (80)
      • HTML & CSS (2)
      • Javascript & jQuery (13)
      • React (13)
      • C언어 (1)
      • JAVA (22)
      • Python (2)
      • Oracle SQL (10)
      • My SQL (5)
      • Spring (12)
    • 💻Programmers (17)
    • 🏫 Open API_JAVA (101)
    • 🌎 Project (10)
      • Shopping (10)
    • 💥 Error (24)
    • ⚙ Setting (23)

블로그 메뉴

  • 홈
  • 방명록

공지사항

인기 글

태그

  • 창초기화
  • CSS
  • Eclipse
  • Database
  • 기간쿼리
  • oracle
  • 코딩앙마
  • colaboratory
  • 이것이자바다
  • 콜라보레이토리
  • 기간설정
  • Javascript
  • googlecolaboratory
  • 서버등록
  • spring
  • SQLD합격
  • AllArgsConstructor
  • 백준
  • HTML
  • 시작일종료일
  • 연습문제
  • 독학후기
  • 파이썬온라인
  • sql기간
  • 오류해결
  • SQL
  • SQLD합격후기
  • 비쥬얼스튜디오코드
  • 노마드코더
  • java

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
Dorothy_YANG

With Dorothy

[95일차] 코틀린 배열 / 코틀린 컬렉션 / 후기 댓글 수정하기
🏫 Open API_JAVA

[95일차] 코틀린 배열 / 코틀린 컬렉션 / 후기 댓글 수정하기

2022. 12. 11. 21:28
728x90

20221207(수)

  • 목차
    - 코틀린 배열
    - 코틀린 컬렉션
    - 후기 댓글 수정하기

< 코틀린 배열 >

  • Test2-array.kt
package com.example.androidlab.lab3.test2

// 배열 : Array 클래스를 사용.


fun main() {
    val arr1: Array<Int> = Array(3, {0})
    arr1[0] = 10
    arr1[1] = 20
    arr1.set(2, 30)

    println("${arr1.size}, ${arr1[0]}, ${arr1.get(2)}")

    // 타입유추
    val arr2 = arrayOf<Int>(10, 20, 30)

    // 기초데이타타입에 해당하는 배열클래스
    val arr3: LongArray = LongArray(3, {0L})

}

< 코틀린 컬렉션 >

     ✔ 컬렉션
          List, Set, Map
          ➡ 코틀린은 컬렉션을 muttable(가변) collection vs immutable(불변) collection으로 분류

           1) muttable(가변) collection : 자바와 동일.
           특징? 추가, 변경이 가능

           2) immutable(불변) collection
           특징? 추가, 변경이 불가능

 

  • Test2-collection.kt
package com.example.androidlab.lab3.test2

fun main() {
    // 1) List : immutable(불변) collection
    var list = listOf<Int>(10, 20, 30)
    list.get(0)
    // list.set() 메서드 지원이 안됨.

    // 2) List : mutable(가변) collection
    var list2 = mutableListOf<Int>(10, 20, 30)
    list2.get(0)
    list2.set(1, 30)



    // Map
    var map = mapOf<String, String>(Pair("one","hello"), "two" to "world")

    println(
        """
        map.size : ${map.size}
        map.data : ${map.get("one")}, ${map.get("two")}
        """.trimIndent()
    )

}

 


< 후기 댓글 수정하기 >

 

productDetail.jsp

// 상품후기 수정폼 . review_edit
      $("div#reviewList div#reviewItem").on("click", "button[name='review_edit']", function() {

        $("#btn_review_write").hide();
        $("#btn_review_edit").show();

        let rv_score = $(this).parent().parent().find("input[name='rv_score']").val();
        let rv_num = $(this).data("rv_num");
        let rv_content = $(this).parent().siblings("p").html();

        console.log("별평점 : " + rv_score);
        console.log("상품후기 번호 : " + rv_num);
        console.log("상품후기 내용 : " + rv_content);
      
        $("#rv_content").val(rv_content);

        $("#rv_content").parent().remove("input[name='rv_num']");
        $("#rv_content").parent().append("<input type='text' name='rv_num' value = '" + rv_num + "'>");

        $("#star_rv_score a.rv_score").each(function(index, item){
          if(index < rv_score) {
            $(item).addClass("on");
          }else {
            $(item).removeClass("on");
          }
        });
728x90
저작자표시 (새창열림)

'🏫 Open API_JAVA' 카테고리의 다른 글

[97일차] 상품 상세페이지 버튼 추가 / 관리자 주문목록 페이지  (0) 2022.12.11
[96일차] 무통장 결제  (0) 2022.12.11
[94일차] 코틀린(변수와 함수 / 기초 데이타 타입) / 상품후기댓글 수정/삭제 버튼  (0) 2022.12.07
[93일차] 안드로이드 코틀린 / 상품 후기 등록, 댓글 리스트 및 페이징  (0) 2022.12.05
[92일차] 주문하기 코드모음 / 상품 상세페이지 / 상품 후기 작성  (0) 2022.12.05
    '🏫 Open API_JAVA' 카테고리의 다른 글
    • [97일차] 상품 상세페이지 버튼 추가 / 관리자 주문목록 페이지
    • [96일차] 무통장 결제
    • [94일차] 코틀린(변수와 함수 / 기초 데이타 타입) / 상품후기댓글 수정/삭제 버튼
    • [93일차] 안드로이드 코틀린 / 상품 후기 등록, 댓글 리스트 및 페이징
    Dorothy_YANG
    Dorothy_YANG
    Slowly but Surely, 비전공 문과생의 개발공부

    티스토리툴바