22-08-09 진행상황

(。◠ ◠。)·2022년 8월 9일
0

드디어.. 메인페이지를 만들었다

브랜드의 경우 <c:choose>를 사용하여 값이 해당 브랜드 값일 경우 해당 브랜드 사진이 나오게 처리하였다.
리뷰이미지도 마찬가지로 <c:choose>를 사용하여 이미지가 null이 아닌경우에 이미지를 출력하게 하였다.

			<c:choose>
				<c:when test="${list.productBrand == 'cu'}">
					<img src="upload/cu.jpg" width="50px" style="float:left;">				
				</c:when>
					<c:when test="${list.productBrand == 'GS25'}">
				<img src="upload/gs.jpg" width="40px" style="float:left;">		
				</c:when>				
			</c:choose>		
            <!--리뷰이미지가 있을경우에만 표시 -->
			<c:choose>
				<c:when test="${list.reviewPic eq null }">
				</c:when>
				<c:otherwise>
					<div style="text-align: right; float:right;">
						<img src="upload/${list.reviewPic }" height="150px" style="border-radius: 15px; ">					
					</div>
				</c:otherwise>
			</c:choose>

평균별점도 추가하였다. 소수점 1의자리에서 반올림하여 볼 수 있도록 처리하였다.

	public double AvgGrade(String productName) {
		String sql = "select round(AVG(grade),1) avg from review where productname = ?";
		conn = db.getConnection();
		double result = 0;
		try {
			PreparedStatement pstmt = conn.prepareStatement(sql);
			pstmt.setString(1, productName);
			pstmt.executeUpdate();
			ResultSet rs = pstmt.executeQuery();
			rs.next();
			result = rs.getDouble(1);
			pstmt.close();			
		} catch (SQLException e) {
			e.printStackTrace();
		}		
		return result;		
	}


디테일 페이지에서 리뷰작성 안내를 넣어놓았다.
다른 jsp에서 let으로 변수설정한걸 그대로 쓸수있는게 신기했다..
let에 설정해놓은 세션값이 있는경우 해당 부분의 class를 display : none;으로 적용시켰다.

		if (nickname != "null") {
			$("#layer").attr("class","hide");
		}

비회원인 경우 해당 부분을 클릭하면 로그인 팝업창이 뜬다

profile
화이탱!

0개의 댓글