ProfileDTO : specialty 자료형 변경
package lv.backend.dto;
public class ProfileDTO {
private int seq;
private String name;
private String title;
private String phone;
private String[] specialty;
private String office_name;
private String office_phone;
private String test;
private String education;
private String id;
private String img;
public ProfileDTO() {
super();
}
public ProfileDTO(String name, String title, String phone, String[] specialty, String office_name,
String office_phone, String test, String education, String id, String img) {
super();
this.name = name;
this.title = title;
this.phone = phone;
this.specialty = specialty;
this.office_name = office_name;
this.office_phone = office_phone;
this.test = test;
this.education = education;
this.id = id;
this.img = img;
}
public ProfileDTO(int seq, String name, String title, String phone, String[] specialty, String office_name,
String office_phone, String test, String education, String id) {
super();
this.seq = seq;
this.name = name;
this.title = title;
this.phone = phone;
this.specialty = specialty;
this.office_name = office_name;
this.office_phone = office_phone;
this.test = test;
this.education = education;
this.id = id;
}
public ProfileDTO(String name, String title, String phone, String[] specialty, String office_name,
String office_phone, String test, String education, String id) {
super();
this.name = name;
this.title = title;
this.phone = phone;
this.specialty = specialty;
this.office_name = office_name;
this.office_phone = office_phone;
this.test = test;
this.education = education;
this.id = id;
}
public ProfileDTO(int seq, String name, String title, String phone, String[] specialty, String office_name,
String office_phone, String test, String education, String id, String img) {
super();
this.seq = seq;
this.name = name;
this.title = title;
this.phone = phone;
this.specialty = specialty;
this.office_name = office_name;
this.office_phone = office_phone;
this.test = test;
this.education = education;
this.id = id;
this.img = img;
}
public String getImg() {
return img;
}
public void setImg_location(String img) {
this.img = img;
}
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String[] getSpecialty() {
return specialty;
}
public void setSpecialty(String[] specialty) {
this.specialty = specialty;
}
public String getOffice_name() {
return office_name;
}
public void setOffice_name(String office_name) {
this.office_name = office_name;
}
public String getOffice_phone() {
return office_phone;
}
public void setOffice_phone(String office_phone) {
this.office_phone = office_phone;
}
public String getTest() {
return test;
}
public void setTest(String test) {
this.test = test;
}
public String getEducation() {
return education;
}
public void setEducation(String education) {
this.education = education;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
ProfileController : getParameterValues로 배열값 저장
package lv.backend.controller;
import java.io.File;
import java.io.IOException;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gson.Gson;
import com.oreilly.servlet.MultipartRequest;
import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
import lv.backend.dao.LawyerDAO;
import lv.backend.dao.ProfileDAO;
import lv.backend.dto.LawyerDTO;
import lv.backend.dto.ProfileDTO;
@WebServlet("*.profile")
public class ProfileController extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf8");
response.setCharacterEncoding("utf8");
String contextPath = request.getContextPath();
String requestURI = request.getRequestURI();
String cmd = requestURI.substring(contextPath.length());
ProfileDAO pdao = new ProfileDAO();
LawyerDTO ldto = new LawyerDTO();
LawyerDAO ldao = new LawyerDAO();
// --ProfileDAO--
// seq 변호사 프로필 게시판 글번호;
// name : 변호사 이름;
// title : 프로필타이틀(홍보문구);
// phone : 변호사 번호;
// specialty : 전문분야 String (썸머노트?);
// office_name : 사무소이름;
// office_phone : 사무소번호;
// test : 출신시험;
// education : 교육사항 String (썸머노트?);
// id : 변호사 회원 아이디;
// img : 저장된 사진 이름 <img src='${pageContext.request.contextPath}/upload/"+resp[i].img+"''> 경로로 출력;
//프로필 사진 저장 파일 생성
String uploadPath = request.getServletContext().getRealPath("upload");
File uploadPathF = new File(uploadPath);
if(!uploadPathF.exists()) { //경로가 없다면
uploadPathF.mkdir(); //만들어라
}
System.out.println("저장 경로 : "+ uploadPath );
try {
if(cmd.contentEquals("/write.profile")) {
MultipartRequest multi = new MultipartRequest(
request,
uploadPath,
1024*1024*10, //사이즈
"utf8", //인코딩
new DefaultFileRenamePolicy() // 이름 겹치면 덮어씌워짐 -> 중복 방지 필요 : 처리코드를 직접 쓸수도 있지만, 디폴트값으로
);
String sysName = multi.getFilesystemName("file");
String oriName = multi.getOriginalFileName("file");
System.out.println("저장된 사진 이름 : "+ sysName);
System.out.println("원래 사진 이름 : "+ oriName);
// 변호사 로그인시 세션 확인!
String lawyerid = (String)request.getSession().getAttribute("lawyerInfo");
ldto = ldao.lSelect(lawyerid);
// String name = "이름";
String name = ldto.getName();
String title = multi.getParameter("title");
// String phone = "번호";
String phone = ldto.getPhone();
// String specialty = multi.getParameter("specialty"); // 전문분야 한개만
String[] specialty = multi.getParameterValues("specialty");
// String office_name = "사무소명";
// String office_phone = "사무소번호";
// String test = "출신시험";
String office_name = ldto.getOffice_name();
String office_phone = ldto.getOffice_phone();
String test = ldto.getTest();
String education = multi.getParameter("education");
// String id = "아이디";
String id = ldto.getId();
String img = sysName;
System.out.println("title : " + title);
System.out.println("specialty : " + specialty);
System.out.println("education : " + education);
System.out.println("img(저장된 이름) : " + img);
int result = pdao.insertProfile(new ProfileDTO(name,title,phone,specialty,office_name,office_phone,test,education,id,img));
if(result>0) {
response.sendRedirect("profileList.jsp");
}else {
response.sendRedirect("error.jsp");
}
}else if(cmd.contentEquals("/toProfileList.profile")) {
response.sendRedirect("profileList.jsp");
}else if(cmd.contentEquals("/profileListAjax.profile")){
int cpage = Integer.parseInt(request.getParameter("cpage"));
try {
List<ProfileDTO> list = pdao.selectByPageNo(cpage);
//클라이언트는 JSON으로 받는게 좋음 : List<BoardDTO>를 JSON으로
String respArr = new Gson().toJson(list);
response.getWriter().append(respArr);
//프로필 수정 / 삭제 기능 미구현
} catch (Exception e) {
e.printStackTrace(); //에러나면 어쩌피 fail로 가기 때문에 여기서 따로 에러페이지 보낼 필요없음
response.sendError(500); //에러메세지를 응답으로 보내겠
}
}else if(cmd.contentEquals("/toProfile.profile")) {
// System.out.println("toProfile.profile 컨트롤러 실행 : "+request.getQueryString().substring(4) );
// System.out.println(request.getParameter("seq"));
int seq = Integer.parseInt(request.getParameter("seq"));
System.out.println("받아온 시퀀스 확인용 : "+seq); // 받아온 시퀀스 확인용
ProfileDTO pdto = pdao.selectBySeq(seq);
request.setAttribute("pdto", pdto);
// List<FileDTO> fileList = dao.selectFileBySeq(seq);
// request.setAttribute("fileList", fileList);
RequestDispatcher rd = request.getRequestDispatcher("profile.jsp");
rd.forward(request, response);
}else if(cmd.contentEquals("/delete.profile")) {
int seq = Integer.parseInt(request.getParameter("seq"));
pdao.deleteBySeq(seq);
response.sendRedirect("toProfileList.profile");
}else if(cmd.contentEquals("/toProfileModify.profile")) {
// 프로필에서 수정하기 버튼을 누르면
// 해당 글seq로 프로필dto를 새로 찾아서
// 수정하기 페이지로 이동
int seq = Integer.parseInt(request.getParameter("seq"));
System.out.println("modify할 seq : "+seq); // 받아온 시퀀스 확인용
ProfileDTO dto = pdao.selectBySeq(seq);
request.setAttribute("dto", dto);
RequestDispatcher rd = request.getRequestDispatcher("profileModify.jsp");
rd.forward(request, response);
}else if(cmd.contentEquals("/modify.profile")) {
int seq = Integer.parseInt(request.getParameter("seq"));
// 변호사 테이블에서 불러오기?
// 아니면 여기서도 수정? 외래키는?
MultipartRequest multi = new MultipartRequest(
request,
uploadPath,
1024*1024*10, //사이즈
"utf8", //인코딩
new DefaultFileRenamePolicy() // 이름 겹치면 덮어씌워짐 -> 중복 방지 필요 : 처리코드를 직접 쓸수도 있지만, 디폴트값으로
);
String sysName = multi.getFilesystemName("file");
String oriName = multi.getOriginalFileName("file");
System.out.println("저장된 사진 이름 : "+ sysName);
System.out.println("원래 사진 이름 : "+ oriName);
// 변호사 로그인시 세션 확인!
String lawyerid = (String)request.getSession().getAttribute("lawyerInfo");
ldto = ldao.lSelect(lawyerid);
// String name = "이름";
String name = ldto.getName();
String title = multi.getParameter("title");
// String phone = "번호";
String phone = ldto.getPhone();
String[] specialty = multi.getParameterValues("specialty");
// String office_name = "사무소명";
// String office_phone = "사무소번호";
// String test = "출신시험";
String office_name = ldto.getOffice_name();
String office_phone = ldto.getOffice_phone();
String test = ldto.getTest();
String education = multi.getParameter("education");
// String id = "아이디";
String id = ldto.getId();
String img = sysName;
int result = pdao.updateBySeq(new ProfileDTO(seq,name,title,phone,specialty,office_name,office_phone,test,education,id,img));
response.sendRedirect("toProfile.profile?seq="+seq);
}else if(cmd.contentEquals("/toReservation.profile")) {
//예약페이지 'reservation.jsp'로 해당 시퀀스의 profileDTO 넘기기
int seq = Integer.parseInt(request.getParameter("seq"));
ProfileDTO pdto = pdao.selectBySeq(seq);
request.setAttribute("pdto", pdto);
RequestDispatcher rd = request.getRequestDispatcher("reservation.jsp");
rd.forward(request, response);
}
}catch(Exception e) {
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
ProfileDAO
pstat.setString(4, Arrays.toString(dto.getSpecialty()));// 배열을 스트링으로
String[] specialty = rs.getString("specialty").replace("[", "").replace("]", "").split(","); // 문자열을 배열로
package lv.backend.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import lv.backend.dto.ProfileDTO;
import lv.backend.statics.Configuration;
public class ProfileDAO {
private Connection getConnection() throws Exception{
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/dbcp"); //경로
return ds.getConnection();
}
public int insertProfile(ProfileDTO dto) throws Exception{
String sql = "insert into profile_board values(profile_board_seq.nextval,?,?,?,?,?,?,?,?,?,?)";
try(Connection con = this.getConnection();
PreparedStatement pstat = con.prepareStatement(sql)){
pstat.setString(1, dto.getName());
pstat.setString(2, dto.getTitle());
pstat.setString(3, dto.getPhone());
pstat.setString(4, Arrays.toString(dto.getSpecialty()));// 배열을 스트링으로
pstat.setString(5, dto.getOffice_name());
pstat.setString(6, dto.getOffice_phone());
pstat.setString(7, dto.getTest());
pstat.setString(8, dto.getEducation());
pstat.setString(9, dto.getId());
pstat.setString(10, dto.getImg());
int result = pstat.executeUpdate();
System.out.println("insertProfile 결과 : "+result);
con.commit();
return result;
}
}
//전체 프로필 리스트 불러오기
public List<ProfileDTO> selectAll() throws Exception{
String sql = "select * from profile_board order by 1";
List<ProfileDTO> result = new ArrayList<>();
try(Connection con = this.getConnection();
PreparedStatement pstat = con.prepareStatement(sql);
ResultSet rs = pstat.executeQuery(); ){
while(rs.next()) {
int seq = rs.getInt("seq");
String name = rs.getString("name");
String title = rs.getString("title");
String phone = rs.getString("phone");
String[] specialty = rs.getString("specialty").replace("[", "").replace("]", "").split(","); // 문자열을 배열로
String office_name = rs.getString("office_name");
String office_phone = rs.getString("office_phone");
String test = rs.getString("test");
String education = rs.getString("education");
String id = rs.getString("id");
ProfileDTO dto = new ProfileDTO(seq,name,title,phone,specialty,office_name,office_phone,test,education,id);
result.add(dto);
}
return result;
}
}
// 전체를 불러오지 말고 일부만 불러오는 경우
public List<ProfileDTO> selectByPageNo(int cpage) throws Exception{
int start = cpage * Configuration.recordCountPerPage - (Configuration.naviCountPerPage-1);
int end = start + (Configuration.recordCountPerPage-1);
String sql = "select * from (select profile_board.*, row_number() over(order by seq desc) rnum from profile_board) where rnum between ? and ?";
List<ProfileDTO> list = new ArrayList<>();
try(Connection con = this.getConnection();
PreparedStatement pstat = con.prepareStatement(sql);
){
pstat.setInt(1, start);
pstat.setInt(2, end);
try(ResultSet rs = pstat.executeQuery();){
while(rs.next()) {
int seq = rs.getInt("seq");
String name = rs.getString("name");
String title = rs.getString("title");
String phone = rs.getString("phone");
String[] specialty = rs.getString("specialty").replace("[", "").replace("]", "").split(","); // 문자열을 배열로
String office_name = rs.getString("office_name");
String office_phone = rs.getString("office_phone");
String test = rs.getString("test");
String education = rs.getString("education");
String id = rs.getString("id");
String img = rs.getString("img");
ProfileDTO dto = new ProfileDTO(seq,name,title,phone,specialty,office_name,office_phone,test,education,id,img);
list.add(dto);
}
return list;
}
}
}
public String getpageNavi(int currentPage) throws Exception {
//총 몇개의 글이 있는가? 한페이지에 몇개의 글을 보여줄 것인가?
int recordTotalCount = this.getArticleCount(); // 총 게시물의 개수
int recordCountPerPage = 10;// 한 페이지에 게시글 몇개를 보여줄 것인가?
int naviCountPerPage = 10; //한 페이지에 네비게이터 몇개를 보여줄 것인가?
int pageTotalCount = 0; // 전체 페이지의 개수
if(recordTotalCount % recordCountPerPage > 0) {
pageTotalCount = recordTotalCount / recordCountPerPage + 1;
// 게시글 개수를 페이지당 게시글로 나누어 나머지 값이 있으면 한페이지를 더한다.
// ex) 147개의 글이 있다면 10글 짜리 14페이지 + 7글짜리 1페이지 -> 총 15페이지 필요
}else {
pageTotalCount = recordTotalCount / recordCountPerPage;
// 게시글 개수를 페이지당 게시글로 나누어 나머지 값이 없으면 더할 필요없다.
// ex) 140개의 글이 있다면 10글 짜리 14페이지로 끝.
}
//현재 내가 위치한 페이지 번호, 1~pageTotalCount까지의 범위를 가진다.
if(currentPage < 1) {
currentPage = 1;
}else if(currentPage > pageTotalCount) {
currentPage = pageTotalCount;
} // 공격자가 currentPage 값을 변조할 경우에 대한 보안 코드
int startNavi = (currentPage - 1) / Configuration.naviCountPerPage * Configuration.naviCountPerPage + 1 ;
int endNavi = startNavi + naviCountPerPage - 1 ;
if(endNavi > pageTotalCount) {
endNavi = pageTotalCount;
}
boolean needPrev = true;
boolean needNext = true;
if(startNavi == 1) {needPrev = false;}
if(endNavi == pageTotalCount) {needNext = false;}
StringBuilder sb = new StringBuilder(); // 리턴할 스트링 조합
if(needPrev) {
sb.append("<li><a href='toProfileListView.profile?cpage="+(startNavi-1)+"'><</a></li>");
}
for (int i = startNavi;i <= endNavi;i++) {
sb.append("<li><a href='toProfileListView.profile?cpage="+i+"'>"+i+"</a></li>");
}
if(needNext) {
sb.append("<li><a href='toProfileListView.profile?cpage="+(endNavi+1)+"'>></a></li>");
}
return sb.toString();
}
public int getArticleCount() throws Exception{
String sql = "select count(*) from profile_board";
try(Connection con = this.getConnection();
PreparedStatement pstat = con.prepareStatement(sql);
ResultSet rs = pstat.executeQuery();){
rs.next(); // 안쓰면 헤더를 가르키는 상태
return rs.getInt(1);
}
}
public ProfileDTO selectBySeq(int seq) throws Exception{
String sql = "select * from profile_board where seq=?";
try(
Connection con = this.getConnection();
PreparedStatement pstat = con.prepareStatement(sql);
){
pstat.setInt(1, seq);
try(
ResultSet rs = pstat.executeQuery();
){
ProfileDTO dto = null;
if(rs.next()) {
String name = rs.getString("name");
String title = rs.getString("title");
String phone = rs.getString("phone");
String[] specialty = rs.getString("specialty").replace("[", "").replace("]", "").split(","); // 문자열을 배열로
String office_name = rs.getString("office_name");
String office_phone = rs.getString("office_phone");
String test = rs.getString("test");
String education = rs.getString("education");
String id = rs.getString("id");
String img = rs.getString("img");
dto = new ProfileDTO(seq,name,title,phone,specialty,office_name,office_phone,test,education,id,img);
}
return dto;
}
}
}
public int deleteBySeq(int seq) throws Exception{
String sql = "delete from profile_board where seq=?";
try(
Connection con = this.getConnection();
PreparedStatement pstat = con.prepareStatement(sql);
){
pstat.setInt(1, seq);
int result = pstat.executeUpdate();
con.commit();
return result;
}
}
public int updateBySeq(ProfileDTO dto) throws Exception{
if(dto.getImg() !=null) {
String sql = "update profile_board set title=?, specialty=?, education=?, img=? where seq =?";
try(
Connection con = this.getConnection();
PreparedStatement pstat = con.prepareStatement(sql);
){
pstat.setString(1, dto.getTitle());
pstat.setString(2, Arrays.toString(dto.getSpecialty()));// 배열을 스트링 한개로
pstat.setString(3, dto.getEducation());
pstat.setString(4, dto.getImg());
pstat.setInt(5, dto.getSeq());
int result = pstat.executeUpdate();
con.commit();
return result;
}
}else { //이미지를 새로 업로드 하지 않은 경우 기존 이미지 유지
String sql = "update profile_board set title=?, specialty=?, education=? where seq =?";
try(
Connection con = this.getConnection();
PreparedStatement pstat = con.prepareStatement(sql);
){
pstat.setString(1, dto.getTitle());
pstat.setString(2, Arrays.toString(dto.getSpecialty()));
pstat.setString(3, dto.getEducation());
pstat.setInt(4, dto.getSeq());
int result = pstat.executeUpdate();
con.commit();
return result;
}
}
}
}
배열 El 표현으로 꺼내기
profileList.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css">
<style>
* {
box-sizing: border-box;
text-align: center;
}
/* 전체 틀 설정 (header, contents, footer영역) */
.container {
width: 100%;
margin: auto;
}
.header {
/*맨위 고정메뉴*/
position: fixed;
width: 100%;
z-index: 5;
background-color: white;
margin: 0px;
width: 100%;
}
.contents {
text-align: center;
position: relative;
top: 100px;
margin: auto;
}
.footer {
position: relative;
top: 170px;
width: 100%;
margin: auto;
}
/* header 영역 설정 */
.q_menu_btn {
text-align: left;
padding-top: 10px;
}
/*퀵메뉴 버튼*/
.quickBtn {
border: 0px solid white;
background-color: white;
width: 50px;
height: 50px;
}
.quickLine {
border-bottom: 3px solid #f56a6a;
padding: 3px;
}
.logo {
width: 200px;
padding-top: 10px;
}
.navi {
padding: 0px;
}
.nav {
height: 100%;
}
.nav-item {
line-height: 60px;
}
.nav-link {
font-size: 18px;
font-weight: 600;
color: #f56a6a;
}
.nav-link:hover {
color: #f9a5a5;
}
/* footer 영역 */
.footer {
padding: 0;
}
.sponser {
border: 1px solid lightgray;
}
.info1, .info3 {
text-align: left;
}
.info2, .info4 {
text-align: right;
}
.doosancompany {
width: 100px;
}
.linklogo {
width: 30px;
}
.infotext {
font-size: 13px;
color: gray;
}
.info2>a {
color: black;
}
/* 퀵메뉴 사이드바 설정 */
.quickmenu {
width: 230px;
height: 100%;
background-color: #f5f5f5;
text-align: center;
position: fixed;
z-index: 10;
top: 0px;
left: -230px;
/*퀵메뉴 위치*/
transition-duration: 0.5s;
}
.quick_title {
/*사이드바 Menu title 부분*/
color: black;
font-size: 20px;
font-weight: 600;
text-align: left;
padding-top: 70px;
padding-left: 30px;
}
.q_line {
/* Menu 밑에 빨간줄 */
border-bottom: 3px solid #f56a6a;
width: 60px;
}
.quick_menu {
padding-top: 10px;
}
.quick_menu>li {
position: relative;
width: 100%;
height: 50px;
list-style-type: none;
padding-left: 30px;
}
.q_m_line {
/*사이드메뉴 나누는 회색줄*/
border: 0.5px solid lightgray;
width: 150px;
}
.q_b_line {
/*메뉴,로그인 나누는 굵은 회색줄*/
border: 1px solid lightgray;
width: 200px;
position: relative;
left: 20px;
top: 30px;
display: none;
}
.quick_menu>li>a {
/* 사이드바 메뉴 글씨 */
position: relative;
text-decoration: none;
color: dimgray;
display: block;
width: 100%;
height: 100%;
line-height: 50px;
text-align: left;
}
.quick_menu>li>a:hover {
color: darkgray;
}
#q_back:hover {
cursor: pointer;
}
/* 사이드바 닫는 화살표 */
#q_back {
margin-left: 170px;
margin-top: 10px;
font-size: 30px;
font-weight: 600;
width: 50px;
height: 50px;
position: fixed;
}
#back_arrow {
width: 30px;
height: 30px;
z-index: 20;
}
/*화살표 이미지설정*/
/* 여기서부터 담당 페이지 스타일 추가하시면 됩니다. */
#p_board {
width: 720px;
height: 700px;
margin: auto;
border: 1px solid gray;
overflow-y: auto;
-ms-overflow-style: none; /*스크롤바 숨기기 - IE and Edge */
scrollbar-width: none; /* 스크롤바 숨기기 - Firefox */
}
#p_board::-webkit-scrollbar {
display: none; /* 스크롤바 숨기기 - Chrome, Safari, Opera*/
}
.article {
float: left;
height: 100px;
width: 100%;
text-align: center;
background-color: #f5f5f5;
margin-bottom :10px;
}
.title {
float: left;
width: 80%;
height: 50%;
text-align: left;
line-height: 50px;
margin-left : 10px;
}
.name {
float: left;
width: 80%;
height: 25%;
text-align: left;
line-height: 25px;
text-size: 25px;
margin-left : 10px;
}
.phone {
color: #f56a6a;
float: left;
width: 80%;
height: 25%;
text-align: left;
line-height: 25px;
margin-left : 10px;
}
.profileImg {
float: right;
width: 100px;
height: 100%;
}
.thumbnail {
border-radius: 70%;
position: relative;
right: 20px;
padding-top: 100%;
overflow: hidden;
}
.thumbnail .centered {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
transform: translate(50%, 50%);
}
.thumbnail .centered img {
max-width: 100%;
height: 100%;
object-fit: cover;
transform: translate(-50%, -50%);
}
input[type=button], input[type=submit] {
border: 1px;
border-radius: 4px;
background-color: #f56a6a;
color: #f4f5f9;
height: 25px;
margin-top: 20px;
}
a:link { color: red; text-decoration: none;}
a:visited { color: black; text-decoration: none;}
</style>
<script>
var pageNo = 1;
$(function() {
$.ajax({
url : "profileListAjax.profile",
data : {
cpage : pageNo++
},
dataType : "json"
})
.done(
function(resp) {
console.log(resp);
for (var i = 0; i < resp.length; i++) {
console.log(resp[i].seq);
var line = $("<div>");
line.addClass("article")
var title = $("<div>");
title.addClass("title");
title.append(resp[i].title);
var name = $("<div>");
name.addClass("name");
name.append("<a href='toProfile.profile?seq="
+ resp[i].seq
+ "'>"
+ resp[i].name + "</a>");
var phone = $("<div>");
phone.addClass("phone");
phone.append("☎ " + resp[i].office_phone);
var profileImg = $("<div>");
profileImg.addClass("profileImg");
<%-- 회원정보에 이미지가 null일 경우 기본 사진(lawyer.png) 출력 --%>
if(resp[i].img == null){
profileImg.append("<div class=thumbnail><div class=centered><a href='toProfile.profile?seq="+resp[i].seq+"'><img src='${pageContext.request.contextPath}/upload/lawyer.png'></a></div></div>")
}else{
profileImg.append("<div class=thumbnail><div class=centered><a href='toProfile.profile?seq="+resp[i].seq+"'><img src='${pageContext.request.contextPath}/upload/"+resp[i].img+"''></a></div></div>")
}
line.append(name);
line.append(profileImg);
line.append(title);
line.append(phone);
$("#p_board").append(line);
}
});
$("#q_menu_btn").on("click", function(){
$("#quickmenu").css("transform", "translate(100%, 0px)");
})
$("#q_back").on("click", function(){
$(this).parent().css("transform", "translate(-100%, 0px)");
$(this).parent().css("transition-duration", "1s");
})
$("#p_board").on("scroll", function() {
var board = document.getElementById("p_board");
if (board.offsetHeight + board.scrollTop > board.scrollHeight) {
loadData();
}
})
function loadData() {
$.ajax({
url : "profileListAjax.profile",
data : {
cpage : pageNo++
},
dataType : "json"
}).done(
function(resp) {
console.log(resp);
for (var i = 0; i < resp.length; i++) {
var line = $("<div >");
line.addClass("article")
var title = $("<div>");
title.addClass("title");
title.append(resp[i].title);
var name = $("<div>");
name.addClass("name");
name.append("<a href='toProfile.profile?seq="
+ resp[i].seq + "'>" + resp[i].name
+ "</a>");
var phone = $("<div>");
phone.addClass("phone");
phone.append("☎ " + resp[i].office_phone);
var profileImg = $("<div>");
profileImg.addClass("profileImg");
if(resp[i].img == null){
profileImg.append("<div class=thumbnail><div class=centered><a href='toProfile.profile?seq="+resp[i].seq+"'><img src='${pageContext.request.contextPath}/upload/lawyer.png'></a></div></div>")
}else{
profileImg.append("<div class=thumbnail><div class=centered><a href='toProfile.profile?seq="+resp[i].seq+"'><img src='${pageContext.request.contextPath}/upload/"+resp[i].img+"''></a></div></div>")
}
line.append(name);
line.append(profileImg);
line.append(title);
line.append(phone);
$("#p_board").append(line);
}
});
}
$("#writeProfile").on("click", function() {
location.href = "profileWrite.jsp";
})
})
</script>
</head>
<body>
<!-- header 영역 (맨위에 메뉴바) -->
<div class="row header">
<!-- quick menu 버튼 -->
<div class="q_menu_btn col-2 col-sm-1 col-md-0 d-md-none d-block" id=q_menu_btn>
<!-- quickmenu 넣기-->
<button class=quickBtn>
<div class=quickLine></div>
<div class=quickLine></div>
<div class=quickLine></div>
</button>
</div>
<!-- quick menu -->
<div class="quickmenu" id="quickmenu">
<div id=q_back><img src="resources/image/back.png" id=back_arrow></div>
<div class=quick_title>
Menu
<div class=q_line></div>
</div>
<div class=quick_menu>
<li><a href=search.jsp>법률검색</a><div class=q_m_line></div></li>
<li><a href=board.req>의뢰하기</a><div class=q_m_line></div></li>
<li><a href=toProfileList.profile>변호사</a><div class=q_m_line></div></li>
<li><a href=faqlist.question>Q&A</a></li>
</div>
<div class=q_b_line></div>
<div class=quick_title>
Login
<div class=q_line></div>
</div>
<div class=quick_menu>
<c:choose>
<c:when test="${empty sessionScope.clientInfo && empty sessionScope.lawyerInfo}">
<li><a href=login.jsp>로그인</a><div class=q_m_line></div></li>
</c:when>
<c:otherwise>
<li><a href="logout.login">로그아웃</a><div class=q_m_line></div></li>
<li><a href="go.mypage">마이페이지</a></li>
</c:otherwise>
</c:choose>
</div>
</div>
<div class="logo col-2 col-md-3 col-lg-2">
<a href=main.jsp><img src="resources/image/lawview.jpg" class="logo"></a>
</div>
<div class="navi col-9 col-lg-10 d-md-block d-none">
<ul class="nav justify-content-end">
<li class="nav-item">
<a class="nav-link active" href=search.jsp>법률 검색</a>
</li>
<li class="nav-item">
<a class="nav-link" href=board.req>의뢰하기</a>
</li>
<li class="nav-item">
<a class="nav-link" href=toProfileList.profile>변호사</a>
</li>
<li class="nav-item">
<a class="nav-link" href="faqlist.question">Q&A</a>
</li>
<li class="nav-item">
<c:choose>
<c:when test="${empty sessionScope.clientInfo && empty sessionScope.lawyerInfo}">
<a class="nav-link" href=login.jsp>Login</a>
</c:when>
<c:otherwise>
<a class="nav-link" href=logout.login>Logout</a>
</c:otherwise>
</c:choose>
</li>
</ul>
</div>
</div>
<!-- 전체 컨테이너 (헤더,푸터 제외) -->
<div class=container>
<!-- contents 영역 (여기에 각자 컨텐츠들 넣으시면 돼요) -->
<div class=contents>
<div id="p_board"></div>
<c:choose>
<c:when test="${not empty sessionScope.lawyerInfo}">
<div class="col-12" align=right>
<input type=button id=writeProfile value="프로필 작성">
</div>
</c:when>
</c:choose>
</div>
<!-- contents 영역 끝 -->
</div>
<!--container 끝-->
<!-- footer 영역 -->
<div class="row footer">
<div class="col-12 sponser" style="padding: 0"></div>
<div class="col-12 col-md-5 info1 infotext">
<br>Copyrightⓒ 2020 Law View Inc. All Rights Reserved.
</div>
<div class="col-12 col-md-7 info2 infotext">
<br> <a href=#>이용약관 </a>| <a href=#> 개인정보처리방침 </a>| <a href=#>
이메일주소 무단수집 거부 </a>| <a href=#> 정도경영 사이버신문고 </a>| <a href=#> 영상정보처리기기
운영관리 방침 </a>|
</div>
<div class="col-12 col-md-6 info3 infotext">
<br> <a href=main.jsp><img src="resources/image/lawview.jpg"
class="doosancompany"></a> Law View is operated by LAW VIEW Inc.<br>
<br> <a href=#><img src="resources/image/facebook.jpg"
class="linklogo"></a> <a href=#><img
src="resources/image/twitter.jpg" class="linklogo"></a> <a href=#><img
src="resources/image/instagram.png" class="linklogo"></a> <a
href=#><img src="resources/image/youtube.png" class="linklogo"></a>
</div>
<div class="col-12 col-md-6 info4 infotext">
<br>사업자 등록번호 : 851-87-00622 대표자 성명 : 박정수<br> 사업자주소 : 서울특별시
중구 남대문로 120 대일빌딩 2F, 3F<br> 연락처 : 02-722-0858 개인정보관리책임자 : 김영재
</div>
</div>
</body>
</html>
profileWrite.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<style>
* {
box-sizing: border-box;
text-align: center;
}
/* 전체 틀 설정 (header, contents, footer영역) */
.container {
width: 100%;
margin: auto;
}
.header { /*맨위 고정메뉴*/
position: fixed;
width: 100%;
z-index: 5;
background-color: white;
margin: 0px;
width: 100%;
}
.contents {
text-align: center;
position: relative;
top: 100px;
margin: auto;
}
.footer {
position: relative;
top: 170px;
width: 100%;
margin: auto;
}
/* header 영역 설정 */
.q_menu_btn {
text-align: left;
padding-top: 10px;
} /*퀵메뉴 버튼*/
.quickBtn {
border: 0px solid white;
background-color: white;
width: 50px;
height: 50px;
}
.quickLine {
border-bottom: 3px solid #f56a6a;
padding: 3px;
}
.logo {
width: 200px;
padding-top: 10px;
}
.navi {
padding: 0px;
}
.nav {
height: 100%;
}
.nav-item {
line-height: 60px;
}
.nav-link {
font-size: 18px;
font-weight: 600;
color: #f56a6a;
}
.nav-link:hover {
color: #f9a5a5;
}
/* footer 영역 */
.footer {
padding: 0;
}
.sponser {
border: 1px solid lightgray;
}
.info1, .info3 {
text-align: left;
}
.info2, .info4 {
text-align: right;
}
.doosancompany {
width: 100px;
}
.linklogo {
width: 30px;
}
.infotext {
font-size: 13px;
color: gray;
}
.info2>a {
color: black;
}
/* 퀵메뉴 사이드바 설정 */
.quickmenu {
width: 230px;
height: 100%;
background-color: #f5f5f5;
text-align: center;
position: fixed;
z-index: 10;
top: 0px;
left: -230px; /*퀵메뉴 위치*/
transition-duration: 0.5s;
}
.quick_title { /*사이드바 Menu title 부분*/
color: black;
font-size: 20px;
font-weight: 600;
text-align: left;
padding-top: 70px;
padding-left: 30px;
}
.q_line { /* Menu 밑에 빨간줄 */
border-bottom: 3px solid #f56a6a;
width: 60px;
}
.quick_menu {
padding-top: 10px;
}
.quick_menu>li {
position: relative;
width: 100%;
height: 50px;
list-style-type: none;
padding-left: 30px;
}
.q_m_line { /*사이드메뉴 나누는 회색줄*/
border: 0.5px solid lightgray;
width: 150px;
}
.q_b_line { /*메뉴,로그인 나누는 굵은 회색줄*/
border: 1px solid lightgray;
width: 200px;
position: relative;
left: 20px;
top: 30px;
display: none;
}
.quick_menu>li>a { /* 사이드바 메뉴 글씨 */
position: relative;
text-decoration: none;
color: dimgray;
display: block;
width: 100%;
height: 100%;
line-height: 50px;
text-align: left;
}
.quick_menu>li>a:hover {
color: darkgray;
}
#q_back:hover {
cursor: pointer;
} /* 사이드바 닫는 화살표 */
#q_back {
margin-left: 170px;
margin-top: 10px;
font-size: 30px;
font-weight: 600;
width: 50px;
height: 50px;
position: fixed;
}
#back_arrow {
width: 30px;
height: 30px;
z-index: 20;
} /*화살표 이미지설정*/
/* 여기서부터 담당 페이지 스타일 추가하시면 됩니다. */
input[type=button], input[type=submit] {
border: 1px;
border-radius: 4px;
background-color: #f56a6a;
color: #f4f5f9;
height: 25px;
margin-top: 20px;
}
</style>
<script>
$(function(){
$("#q_menu_btn").on("click", function(){
$("#quickmenu").css("transform", "translate(100%, 0px)");
})
$("#q_back").on("click", function(){
$(this).parent().css("transform", "translate(-100%, 0px)");
$(this).parent().css("transition-duration", "1s");
})
//여기서부터 담당 페이지 스크립트 새로 추가하시면 됩니다!
$("#back").on("click", function() {
location.href = 'toProfileList.profile'
});
})
</script>
</head>
<body>
<!-- header 영역 (맨위에 메뉴바) -->
<div class="row header">
<!-- quick menu 버튼 -->
<div class="q_menu_btn col-2 col-sm-1 col-md-0 d-md-none d-block"
id=q_menu_btn>
<!-- quickmenu 넣기-->
<button class=quickBtn>
<div class=quickLine></div>
<div class=quickLine></div>
<div class=quickLine></div>
</button>
</div>
<!-- quick menu -->
<div class="quickmenu" id="quickmenu">
<div id=q_back>
<img src="resources/image/back.png" id=back_arrow>
</div>
<div class=quick_title>
Menu
<div class=q_line></div>
</div>
<div class=quick_menu>
<li><a href=search.jsp>법률검색</a>
<div class=q_m_line></div></li>
<li><a href=board.req>의뢰하기</a>
<div class=q_m_line></div></li>
<li><a href=toProfileList.profile>변호사</a>
<div class=q_m_line></div></li>
<li><a href=faqlist.question>Q&A</a></li>
</div>
<div class=q_b_line></div>
<div class=quick_title>
Login
<div class=q_line></div>
</div>
<div class=quick_menu>
<c:choose>
<c:when
test="${empty sessionScope.clientInfo && empty sessionScope.lawyerInfo}">
<li><a href=login.jsp>로그인</a>
<div class=q_m_line></div></li>
</c:when>
<c:otherwise>
<li><a href="logout.login">로그아웃</a>
<div class=q_m_line></div></li>
<li><a href="go.mypage">마이페이지</a></li>
</c:otherwise>
</c:choose>
</div>
</div>
<div class="logo col-2 col-md-3 col-lg-2">
<a href=main.jsp><img src="resources/image/lawview.jpg"
class="logo"></a>
</div>
<div class="navi col-9 col-lg-10 d-md-block d-none">
<ul class="nav justify-content-end">
<li class="nav-item"><a class="nav-link active" href=search.jsp>법률
검색</a></li>
<li class="nav-item"><a class="nav-link" href=board.req>의뢰하기</a>
</li>
<li class="nav-item"><a class="nav-link"
href=toProfileList.profile>변호사</a></li>
<li class="nav-item"><a class="nav-link"
href="faqlist.question">Q&A</a></li>
<li class="nav-item"><c:choose>
<c:when
test="${empty sessionScope.clientInfo && empty sessionScope.lawyerInfo}">
<a class="nav-link" href=login.jsp>Login</a>
</c:when>
<c:otherwise>
<a class="nav-link" href=logout.login>Logout</a>
</c:otherwise>
</c:choose></li>
</ul>
</div>
</div>
<!-- 전체 컨테이너 (헤더,푸터 제외) -->
<div class=container>
<!-- contents 영역 (여기에 각자 컨텐츠들 넣으시면 돼요) -->
<div class=contents>
<form action=write.profile method="post"
enctype="multipart/form-data">
<div class="container">
<div class="form-group row">
<div class="col-sm">
<input id="title" name="title" class="form-control-plaintext"
type="text" placeholder="제목을 입력하세요.">
</div>
</div>
<div class="form-group">
전문분야<br>
<input type='checkbox' name='specialty' value='이혼' />이혼
<input type='checkbox' name='specialty' value='손해배상' />손해배상
<input type='checkbox' name='specialty' value='폭행' />폭행/협박
<input type='checkbox' name='specialty' value='가사' />가사기타
<input type='checkbox' name='specialty' value='성범죄' />성범죄
<input type='checkbox' name='specialty' value='재산범죄' />재산범죄
<input type='checkbox' name='specialty' value='수사' />수사
<input type='checkbox' name='specialty' value='민사기타' />민사기타 <br>
<input type='checkbox' name='specialty' value='친족' />친족
<input type='checkbox' name='specialty' value='채권추심' />채권추심
<input type='checkbox' name='specialty' value='민사소송절차' />민사소송절차
<input type='checkbox' name='specialty' value='상속' />상속
<input type='checkbox' name='specialty' value='형사기타' />형사기타
<input type='checkbox' name='specialty' value='기타법률서비스' />기타법률서비스
</div>
<div class="form-group">
<textarea class="form-control" name="education"
id="exampleFormControlTextarea1" rows="10"
placeholder="education를 입력하세요."></textarea>
</div>
<div class="form-group">
<input type=file name="file">
</div>
<div id="writeBtn">
<input type="submit" id="write" value="작성 완료"> <input
type="button" id="back" value="목록으로">
</div>
</div>
</form>
</div>
<!-- contents 영역 끝 -->
</div>
<!--container 끝-->
<!-- footer 영역 -->
<div class="row footer">
<div class="col-12 sponser" style="padding: 0"></div>
<div class="col-12 col-md-5 info1 infotext">
<br>Copyrightⓒ 2020 Law View Inc. All Rights Reserved.
</div>
<div class="col-12 col-md-7 info2 infotext">
<br> <a href=#>이용약관 </a>| <a href=#> 개인정보처리방침 </a>| <a href=#>
이메일주소 무단수집 거부 </a>| <a href=#> 정도경영 사이버신문고 </a>| <a href=#> 영상정보처리기기
운영관리 방침 </a>|
</div>
<div class="col-12 col-md-6 info3 infotext">
<br> <a href=main.jsp><img src="resources/image/lawview.jpg"
class="doosancompany"></a> Law View is operated by LAW VIEW Inc.<br>
<br> <a href=#><img src="resources/image/facebook.jpg"
class="linklogo"></a> <a href=#><img
src="resources/image/twitter.jpg" class="linklogo"></a> <a href=#><img
src="resources/image/instagram.png" class="linklogo"></a> <a
href=#><img src="resources/image/youtube.png" class="linklogo"></a>
</div>
<div class="col-12 col-md-6 info4 infotext">
<br>사업자 등록번호 : 851-87-00622 대표자 성명 : 박정수<br> 사업자주소 : 서울특별시
중구 남대문로 120 대일빌딩 2F, 3F<br> 연락처 : 02-722-0858 개인정보관리책임자 : 김영재
</div>
</div>
</body>
</html>
profile.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>LawView</title>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<style>
* {
box-sizing: border-box;
text-align: center;
}
/* 전체 틀 설정 (header, contents, footer영역) */
.container {
width: 100%;
margin: auto;
}
.header {
/*맨위 고정메뉴*/
position: fixed;
width: 100%;
z-index: 5;
background-color: white;
margin: 0px;
width: 100%;
}
.contents {
text-align: center;
position: relative;
top: 100px;
margin: auto;
}
.footer {
position: relative;
top: 170px;
width: 100%;
margin: auto;
}
/* header 영역 설정 */
.q_menu_btn {
text-align: left;
padding-top: 10px;
}
/*퀵메뉴 버튼*/
.quickBtn {
border: 0px solid white;
background-color: white;
width: 50px;
height: 50px;
}
.quickLine {
border-bottom: 3px solid #f56a6a;
padding: 3px;
}
.logo {
width: 200px;
padding-top: 10px;
}
.navi {
padding: 0px;
}
.nav {
height: 100%;
}
.nav-item {
line-height: 60px;
}
.nav-link {
font-size: 18px;
font-weight: 600;
color: #f56a6a;
}
.nav-link:hover {
color: #f9a5a5;
}
/* footer 영역 */
.footer {
padding: 0;
}
.sponser {
border: 1px solid lightgray;
}
.info1, .info3 {
text-align: left;
}
.info2, .info4 {
text-align: right;
}
.doosancompany {
width: 100px;
}
.linklogo {
width: 30px;
}
.infotext {
font-size: 13px;
color: gray;
}
.info2>a {
color: black;
}
/* 퀵메뉴 사이드바 설정 */
.quickmenu {
width: 230px;
height: 100%;
background-color: #f5f5f5;
text-align: center;
position: fixed;
z-index: 10;
top: 0px;
left: -230px;
/*퀵메뉴 위치*/
transition-duration: 0.5s;
}
.quick_title {
/*사이드바 Menu title 부분*/
color: black;
font-size: 20px;
font-weight: 600;
text-align: left;
padding-top: 70px;
padding-left: 30px;
}
.q_line {
/* Menu 밑에 빨간줄 */
border-bottom: 3px solid #f56a6a;
width: 60px;
}
.quick_menu {
padding-top: 10px;
}
.quick_menu>li {
position: relative;
width: 100%;
height: 50px;
list-style-type: none;
padding-left: 30px;
}
.q_m_line {
/*사이드메뉴 나누는 회색줄*/
border: 0.5px solid lightgray;
width: 150px;
}
.q_b_line {
/*메뉴,로그인 나누는 굵은 회색줄*/
border: 1px solid lightgray;
width: 200px;
position: relative;
left: 20px;
top: 30px;
display: none;
}
.quick_menu>li>a {
/* 사이드바 메뉴 글씨 */
position: relative;
text-decoration: none;
color: dimgray;
display: block;
width: 100%;
height: 100%;
line-height: 50px;
text-align: left;
}
.quick_menu>li>a:hover {
color: darkgray;
}
#q_back:hover {
cursor: pointer;
}
/* 사이드바 닫는 화살표 */
#q_back {
margin-left: 170px;
margin-top: 10px;
font-size: 30px;
font-weight: 600;
width: 50px;
height: 50px;
position: fixed;
}
#back_arrow {
width: 30px;
height: 30px;
z-index: 20;
}
/*화살표 이미지설정*/
/* 여기서부터 담당 페이지 스타일 추가하시면 됩니다. */
@font-face {
font-family: "barunGothic";
src: url("NanumBarunGothic.ttf") format("truetype");
font-style: normal;
font-weight: normal;
}
* {
font-family: "barunGothic";
font-size: 20px;
box-sizing: border-box;
}
.container {
border-radius: 3px;
width:750px;
background-color: #f4f5f9;
color: #252c41;
margin: auto;
border: 1px solid #dddfe6;
}
.row:first-child>.col-12 {
border-radius: 3px;
padding: 20px;
}
.row>div {
margin-top: 1px;
background-color: white;
padding: 10px;
}
.comment {
padding: 0px;
}
#box1 {
width: 100%;
border: 1px dotted black;
height: 100%;
float: left;
overflow-y: auto;
}
#box2 {
border-radius: 5px;
height: 100%;
text-align: center;
}
#send {
border: 1px solid #ffffff;
border-radius: 5px;
color: #ffffff;
}
.list {
border-radius: 10px;
margin: auto;
word-wrap: break-word;
word-break: break-all;
}
input[type=button], input[type=submit] {
border: 1px;
border-radius: 4px;
background-color: #f56a6a;
color: #f4f5f9;
height: 30px;
}
.cmt {
postion: relative;
padding: 15px;
background-color: #f4f5f9;
}
.cmt>input {
position: absolute;
right: 10px;
top: 10px;
background-color: #252c41;
}
</style>
<script>
$(function() {
$("#back").on("click", function() {
location.href = "toProfileList.profile";
})
$("#delete").on("click", function() {
var result = confirm("정말 삭제하시겠습니까?");
if (result) {
location.href = "delete.profile?seq=" + ${pdto.seq};
}
})
$("#modify").on("click", function() {
location.href = "toProfileModify.profile?seq=" + ${pdto.seq};
})
$("#reservation").on("click", function() {
location.href = "toReservation.profile?seq=" + ${pdto.seq};
})
})
</script>
</head>
<body>
<!-- header 영역 (맨위에 메뉴바) -->
<div class="row header">
<!-- quick menu 버튼 -->
<div class="q_menu_btn col-2 col-sm-1 col-md-0 d-md-none d-block" id=q_menu_btn>
<!-- quickmenu 넣기-->
<button class=quickBtn>
<div class=quickLine></div>
<div class=quickLine></div>
<div class=quickLine></div>
</button>
</div>
<!-- quick menu -->
<div class="quickmenu" id="quickmenu">
<div id=q_back><img src="resources/image/back.png" id=back_arrow></div>
<div class=quick_title>
Menu
<div class=q_line></div>
</div>
<div class=quick_menu>
<li><a href=search.jsp>법률검색</a><div class=q_m_line></div></li>
<li><a href=board.req>의뢰하기</a><div class=q_m_line></div></li>
<li><a href=toProfileList.profile>변호사</a><div class=q_m_line></div></li>
<li><a href=faqlist.question>Q&A</a></li>
</div>
<div class=q_b_line></div>
<div class=quick_title>
Login
<div class=q_line></div>
</div>
<div class=quick_menu>
<c:choose>
<c:when test="${empty sessionScope.clientInfo && empty sessionScope.lawyerInfo}">
<li><a href=login.jsp>로그인</a><div class=q_m_line></div></li>
</c:when>
<c:otherwise>
<li><a href="logout.login">로그아웃</a><div class=q_m_line></div></li>
<li><a href="go.mypage">마이페이지</a></li>
</c:otherwise>
</c:choose>
</div>
</div>
<div class="logo col-2 col-md-3 col-lg-2">
<a href=main.jsp><img src="resources/image/lawview.jpg" class="logo"></a>
</div>
<div class="navi col-9 col-lg-10 d-md-block d-none">
<ul class="nav justify-content-end">
<li class="nav-item">
<a class="nav-link active" href=search.jsp>법률 검색</a>
</li>
<li class="nav-item">
<a class="nav-link" href=board.req>의뢰하기</a>
</li>
<li class="nav-item">
<a class="nav-link" href=toProfileList.profile>변호사</a>
</li>
<li class="nav-item">
<a class="nav-link" href="faqlist.question">Q&A</a>
</li>
<li class="nav-item">
<c:choose>
<c:when test="${empty sessionScope.clientInfo && empty sessionScope.lawyerInfo}">
<a class="nav-link" href=login.jsp>Login</a>
</c:when>
<c:otherwise>
<a class="nav-link" href=logout.login>Logout</a>
</c:otherwise>
</c:choose>
</li>
</ul>
</div>
</div>
<!-- contents 영역 (여기에 각자 컨텐츠들 넣으시면 돼요) -->
<div class=contents>
<div class="container">
<div class="row">
<div class="col-12" align=center>
<div class="card bg-dark text-white">
<c:if test="${!empty pdto.img}">
<img
src="${pageContext.request.contextPath}/upload/${pdto.img}"
class="card-img" id=profileImg>
</c:if>
<c:if test="${empty dto.img}">
<img
src="${pageContext.request.contextPath}/upload/lawyer.png"
class="card-img" id=profileImg>
</c:if>
<div class="card-img-overlay">
<h5 class="card-title">${pdto.name}</h5>
<p class="card-text">${pdto.title}</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12" align=center>
<b>변호사 ${pdto.name}</b>
</div>
</div>
<div class="row">
<div class="col-12" align=center>
<b> ${pdto.title}</b>
</div>
</div>
<div class="row">
<div class="col-12" align=center>
<b>${pdto.office_name}</b>
</div>
</div>
<div class="row">
<div class="col-12" align=center>
<b>☎ ${pdto.office_phone}</b>
</div>
</div>
<div class="row">
<div class="col-12" align=left>
<b> ${pdto.name}변호사의 전문 분야</b><br>
<c:forEach var="i" begin="0" step="1" end="14">
${pdto.specialty[i]}
</c:forEach>
</div>
</div>
<div class="row">
<div class="col-12" align=left>
<b> ${pdto.name}변호사의 교육 사항을 확인하세요</b><br> <p>${pdto.education}</p>
</div>
</div>
<div class="row">
<div class="col-12"></div>
</div>
<div class="row">
<!--
<c:forEach var="f" items="${fileList}">
<div class="col-12">첨부파일 : ${f.oriFileName}</div>
</c:forEach>
-->
</div>
<c:forEach var="cmt" items="${list}">
<div class="row">
<div class="col-12 list"></div>
</div>
</c:forEach>
<div class="row">
<c:choose>
<c:when test="${pdto.id == sessionScope.lawyerInfo}">
<div class="col-12" align=right>
<input type=button id=back value="프로필 목록으로"> <input
type=button id=delete value="프로필 삭제"> <input type=button
id=modify value="프로필 수정">
</div>
</c:when>
<%-- admin.id 일 때도 버튼이 보이도록 수정 : admin.id는 개발자가 결정?
<c:when test="${not empty sessionScope.adminInfo}">
<div class="col-12" align=right>
<input type=button id=back value="프로필 목록으로"> <input
type=button id=delete value="프로필 삭제"> <input type=button
id=modify value="프로필 수정">
</div>
</c:when>
--%>
<c:otherwise>
<div class="col-12" align=right>
<input type=button id=back value="프로필 목록으로"> <input
type=button id=reservation value="예약하기">
</div>
</c:otherwise>
</c:choose>
</div>
</div>
</div>
<!-- footer 영역 -->
<div class="row footer">
<div class="col-12 sponser" style="padding: 0"></div>
<div class="col-12 col-md-5 info1 infotext">
<br>Copyrightⓒ 2020 Law View Inc. All Rights Reserved.
</div>
<div class="col-12 col-md-7 info2 infotext">
<br> <a href=#>이용약관 </a>| <a href=#> 개인정보처리방침 </a>| <a href=#>
이메일주소 무단수집 거부 </a>| <a href=#> 정도경영 사이버신문고 </a>| <a href=#> 영상정보처리기기
운영관리 방침 </a>|
</div>
<div class="col-12 col-md-6 info3 infotext">
<br> <a href=main.jsp><img src="resources/image/lawview.jpg"
class="doosancompany"></a> Law View is operated by LAW VIEW Inc.<br>
<br> <a href=#><img src="resources/image/facebook.jpg"
class="linklogo"></a> <a href=#><img
src="resources/image/twitter.jpg" class="linklogo"></a> <a href=#><img
src="resources/image/instagram.png" class="linklogo"></a> <a
href=#><img src="resources/image/youtube.png" class="linklogo"></a>
</div>
<div class="col-12 col-md-6 info4 infotext">
<br>사업자 등록번호 : 851-87-00622 대표자 성명 : 박정수<br> 사업자주소 : 서울특별시
중구 남대문로 120 대일빌딩 2F, 3F<br> 연락처 : 02-722-0858 개인정보관리책임자 : 김영재
</div>
</div>
</body>
</html>
profileModify.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<script>
</script>
<style>
*{
box-sizing: border-box;
text-align: center;
}
/* 전체 틀 설정 (header, contents, footer영역) */
.container{width: 100%; margin: auto;}
.header{ /*맨위 고정메뉴*/
position: fixed;
width: 100%;
z-index: 5;
background-color: white;
margin: 0px;
width: 100%;
}
.contents{text-align: center; position: relative; top: 100px; margin: auto;}
.footer{position: relative; top: 170px; width: 100%; margin: auto;}
/* header 영역 설정 */
.q_menu_btn{text-align: left; padding-top: 10px;} /*퀵메뉴 버튼*/
.quickBtn{border: 0px solid white; background-color: white; width: 50px; height: 50px;}
.quickLine{border-bottom: 3px solid #f56a6a; padding: 3px;}
.logo{width: 200px; padding-top: 10px;}
.navi{padding: 0px;}
.nav{height: 100%;}
.nav-item{line-height: 60px;}
.nav-link{font-size: 18px; font-weight: 600; color:#f56a6a;}
.nav-link:hover{color: #f9a5a5;}
/* footer 영역 */
.footer {padding: 0;}
.sponser{border:1px solid lightgray;}
.info1,.info3{text-align: left;}
.info2,.info4{text-align: right;}
.doosancompany{width: 100px;}
.linklogo{width: 30px;}
.infotext{font-size: 13px; color: gray;}
.info2>a{color: black;}
/* 퀵메뉴 사이드바 설정 */
.quickmenu{
width: 230px; height: 100%;
background-color: #f5f5f5;
text-align: center;
position: fixed;
z-index: 10;
top: 0px; left: -230px; /*퀵메뉴 위치*/
transition-duration: 0.5s;
}
.quick_title{ /*사이드바 Menu title 부분*/
color: black;
font-size: 20px;
font-weight: 600;
text-align: left;
padding-top: 70px;
padding-left: 30px;
}
.q_line{ /* Menu 밑에 빨간줄 */
border-bottom: 3px solid #f56a6a;
width: 60px;
}
.quick_menu{
padding-top: 10px;
}
.quick_menu>li{
position: relative;
width: 100%; height: 50px;
list-style-type: none;
padding-left: 30px;
}
.q_m_line{ /*사이드메뉴 나누는 회색줄*/
border: 0.5px solid lightgray;
width: 150px;
}
.q_b_line{ /*메뉴,로그인 나누는 굵은 회색줄*/
border: 1px solid lightgray;
width: 200px;
position: relative;
left: 20px; top: 30px;
display: none;
}
.quick_menu>li>a{ /* 사이드바 메뉴 글씨 */
position: relative;
text-decoration: none;
color: dimgray;
display: block;
width: 100%; height: 100%;
line-height: 50px;
text-align: left;
}
.quick_menu>li>a:hover{color: darkgray;}
#q_back:hover{cursor: pointer;} /* 사이드바 닫는 화살표 */
#q_back{
margin-left: 170px;
margin-top: 10px;
font-size: 30px; font-weight: 600;
width: 50px; height: 50px;
position: fixed;
}
#back_arrow{width: 30px; height: 30px; z-index: 20;} /*화살표 이미지설정*/
/* 여기서부터 담당 페이지 스타일 추가하시면 됩니다. */
input[type=button], input[type=submit] {
border: 1px;
border-radius: 4px;
background-color: #f56a6a;
color: #f4f5f9;
height: 25px;
margin-top: 20px;
}
.thumbnail img{
height : 50px;
width : auto;
}
</style>
<script>
$(function(){
$("#q_menu_btn").on("click", function(){
$("#quickmenu").css("transform", "translate(100%, 0px)");
})
$("#q_back").on("click", function(){
$(this).parent().css("transform", "translate(-100%, 0px)");
$(this).parent().css("transition-duration", "1s");
})
//여기서부터 담당 페이지 스크립트 새로 추가하시면 됩니다!
$("#back").on("click", function() {
location.href = 'toProfileList.profile'
});
})
</script>
</head>
<body>
<!-- header 영역 (맨위에 메뉴바) -->
<div class="row header">
<!-- quick menu 버튼 -->
<div class="q_menu_btn col-2 col-sm-1 col-md-0 d-md-none d-block" id=q_menu_btn>
<!-- quickmenu 넣기-->
<button class=quickBtn>
<div class=quickLine></div>
<div class=quickLine></div>
<div class=quickLine></div>
</button>
</div>
<!-- quick menu -->
<div class="quickmenu" id="quickmenu">
<div id=q_back><img src="resources/image/back.png" id=back_arrow></div>
<div class=quick_title>
Menu
<div class=q_line></div>
</div>
<div class=quick_menu>
<li><a href=search.jsp>법률검색</a><div class=q_m_line></div></li>
<li><a href=board.req>의뢰하기</a><div class=q_m_line></div></li>
<li><a href=toProfileList.profile>변호사</a><div class=q_m_line></div></li>
<li><a href=faqlist.question>Q&A</a></li>
</div>
<div class=q_b_line></div>
<div class=quick_title>
Login
<div class=q_line></div>
</div>
<div class=quick_menu>
<c:choose>
<c:when test="${empty sessionScope.clientInfo && empty sessionScope.lawyerInfo}">
<li><a href=login.jsp>로그인</a><div class=q_m_line></div></li>
</c:when>
<c:otherwise>
<li><a href="logout.login">로그아웃</a><div class=q_m_line></div></li>
<li><a href="go.mypage">마이페이지</a></li>
</c:otherwise>
</c:choose>
</div>
</div>
<div class="logo col-2 col-md-3 col-lg-2">
<a href=main.jsp><img src="resources/image/lawview.jpg" class="logo"></a>
</div>
<div class="navi col-9 col-lg-10 d-md-block d-none">
<ul class="nav justify-content-end">
<li class="nav-item">
<a class="nav-link active" href=search.jsp>법률 검색</a>
</li>
<li class="nav-item">
<a class="nav-link" href=board.req>의뢰하기</a>
</li>
<li class="nav-item">
<a class="nav-link" href=toProfileList.profile>변호사</a>
</li>
<li class="nav-item">
<a class="nav-link" href="faqlist.question">Q&A</a>
</li>
<li class="nav-item">
<c:choose>
<c:when test="${empty sessionScope.clientInfo && empty sessionScope.lawyerInfo}">
<a class="nav-link" href=login.jsp>Login</a>
</c:when>
<c:otherwise>
<a class="nav-link" href=logout.login>Logout</a>
</c:otherwise>
</c:choose>
</li>
</ul>
</div>
</div>
<!-- 전체 컨테이너 (헤더,푸터 제외) -->
<div class=container>
<!-- contents 영역 (여기에 각자 컨텐츠들 넣으시면 돼요) -->
<div class=contents>
<form action=modify.profile?seq=${dto.seq} method="post" enctype="multipart/form-data">
<div class="container">
<div class="form-group row">
<div class="col-sm">
<input id="title" name="title" class="form-control-plaintext"
type="text" value=${dto.title}>
</div>
</div>
<div class="form-group">
<b> ${dto.name}변호사의 전문 분야</b><br>
<c:forEach var="i" begin="0" step="1" end="14">
${dto.specialty[i]}
</c:forEach>
<input type='checkbox' name='specialty' value='이혼' />이혼
<input type='checkbox' name='specialty' value='손해배상' />손해배상
<input type='checkbox' name='specialty' value='폭행' />폭행/협박
<input type='checkbox' name='specialty' value='가사' />가사기타
<input type='checkbox' name='specialty' value='성범죄' />성범죄
<input type='checkbox' name='specialty' value='재산범죄' />재산범죄
<input type='checkbox' name='specialty' value='수사' />수사
<input type='checkbox' name='specialty' value='민사기타' />민사기타 <br>
<input type='checkbox' name='specialty' value='친족' />친족
<input type='checkbox' name='specialty' value='채권추심' />채권추심
<input type='checkbox' name='specialty' value='민사소송절차' />민사소송절차
<input type='checkbox' name='specialty' value='상속' />상속
<input type='checkbox' name='specialty' value='형사기타' />형사기타
<input type='checkbox' name='specialty' value='기타법률서비스' />기타법률서비스
</div>
<div class="form-group">
<textarea class="form-control" name="education"
id="exampleFormControlTextarea1" rows="10"
placeholder="education 수정">${dto.education}</textarea>
</div>
<div class="form-group">
<p>프로필 사진</p>
<div class=thumbnail>
<img
src="${pageContext.request.contextPath}/upload/${dto.img}"
class="card-img" id=profileImg>
</div>
<input type=file name="file">
</div>
<div id="modifyBtn">
<input type="submit" id="write" value="수정 완료"> <input type="button" id="back" value="목록으로">
</div>
</div>
</form>
</div> <!-- contents 영역 끝 -->
</div> <!--container 끝-->
<!-- footer 영역 -->
<div class="row footer">
<div class="col-12 sponser" style="padding: 0">
</div>
<div class="col-12 col-md-5 info1 infotext">
<br>Copyrightⓒ 2020 Law View Inc. All Rights Reserved.
</div>
<div class="col-12 col-md-7 info2 infotext">
<br>
<a href=#>이용약관 </a>|
<a href=#> 개인정보처리방침 </a>|
<a href=#> 이메일주소 무단수집 거부 </a>|
<a href=#> 정도경영 사이버신문고 </a>|
<a href=#> 영상정보처리기기 운영관리 방침 </a>|
</div>
<div class="col-12 col-md-6 info3 infotext">
<br>
<a href=main.jsp><img src="resources/image/lawview.jpg" class="doosancompany"></a>
Law View is operated by LAW VIEW Inc.<br><br>
<a href=#><img src="resources/image/facebook.jpg" class="linklogo"></a>
<a href=#><img src="resources/image/twitter.jpg" class="linklogo"></a>
<a href=#><img src="resources/image/instagram.png" class="linklogo"></a>
<a href=#><img src="resources/image/youtube.png" class="linklogo"></a>
</div>
<div class="col-12 col-md-6 info4 infotext">
<br>사업자 등록번호 : 851-87-00622 대표자 성명 : 박정수<br>
사업자주소 : 서울특별시 중구 남대문로 120 대일빌딩 2F, 3F<br>
연락처 : 02-722-0858 개인정보관리책임자 : 김영재
</div>
</div>
</body>
</html>