본문 바로가기
SPRING

230316_게시판

by 경 훈 2023. 3. 16.

 

 

<%@ 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>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<c:choose>
	<c:when test="${param.result == 'loginfail'}">
		<script type="text/javascript">
		Swal.fire({
			position: 'center',
			icon: 'error',
			title: '아이디 혹은 비밀번호가 틀림',
			showConfirmButton: false,
			timer: 1500
		})
		</script>
	</c:when>
</c:choose>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<header>
<h1 align="center">
OOOO 쇼핑몰
</h1>
</header>
<nav class="navbar navbar-inverse">
	<div class="container-fluid">
	<div class="navbar-header">
		<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>                        
		</button>
	<a class="navbar-brand" href="/kim18_001/">HOME</a>
	</div> 
	<div class="collapse navbar-collapse" id="myNavbar">
	<ul class="nav navbar-nav">
		<li class="active">
		</li>
		<li class="dropdown">
		<a class="dropdown-toggle" data-toggle="dropdown" href="#">멤버<span class="caret"></span></a>
			<ul class="dropdown-menu">
				<li><a href="memberin">입력</a></li>
			</ul>
		</li>
		<li class="dropdown">
		<a class="dropdown-toggle" data-toggle="dropdown" href="#">상품관리<span class="caret"></span></a>
			<ul class="dropdown-menu">
				<li><a href="spin">입력</a></li>
				<li><a href="spout">출력</a></li>
				<li><a href="spsearch">검색</a></li>
			</ul>
		</li>
	</ul>
	<ul class="nav navbar-nav navbar-right">
		<c:choose>
			<c:when test="${login==true && dto != null}">
				<li><a href="logout">${dto.id}님 환영합니다</a></li>
				<li><a href="logout"><span class="glyphicon glyphicon-log-out"></span>로그아웃</a></li>
			</c:when>
			<c:otherwise>
				<li><a href="memberin"><span class="glyphicon glyphicon-user"></span>회원가입</a></li>
				<li><a href="loginin"><span class="glyphicon glyphicon-log-in"></span>로그인</a></li>
			</c:otherwise>
		</c:choose>
	</ul>
	</div>
	</div>
</nav>
</html>

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="//code.jauery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code,jwuery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	$(function(){
		$("#checksubmit").click(function(){
			var idcheck =$("#idcheck").attr("idcheck");
			if(idcheck =="" || idcheck =="N") {
				Swal.fire({
					position: 'center',
					icon: 'error',
					title: '아이디 중복검사 하세요',
					showConfirmButton: false,
					timer: 1500
				})
				$("#idcheck").focus();
				return;
			}
			$("#form1").submit();
		});
		$("#idcheck").click(function(){
			var id = $("#id").val();
			$.ajax({
				type:"post",
				async:true,
				url:"idcheck",
				dataType:"text",
				data:{"id":id},
				success:function(cnt) {
					if(cnt==0) {
						$("#idcheck").attr('idcheck','Y');
						Swal.fire({
							position: 'center',
							icon: 'success',
							title: '사용가능한 아이디',
							showConfirmButton: false,
							timer: 1500
						})
					}
					else {
						$("#idcheck").attr('idcheck','N');
						Swal.fire({
							position: 'center',
							icon: 'error',
							title: '중복된 아이디',
							showConfirmButton: false,
							timer: 1500
						})
					}
				}
			});
		});
	});
</script>
</head>
<body>
	<h3 align="center">회원가입</h3>
	<form action="membersave" method="post" id="form1">
		<table border="1" align="center">
			<tr>
				<th>아이디</th>
				<td>
					<input type="text" name="id" id="id">
					<input type="button" value="중복검사" id="idcheck" idcheck="">
				</td>
			</tr>
			<tr>
				<th>패스워드</th>
				<td><input type="text" name="pw"></td>
			</tr>
			<tr>
				<th>이름</th>
				<td><input type="text" name="name"></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<input type="button" value="검사후가입" id="checksubmit">
				</td>
			</tr>
		</table>
	</form>
</body>
</html>

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h3 align="center">로그인</h3>
	<form action="logincheck" method="post">
		<table border="1" align="center">
			<tr>
				<th>아이디</th>
				<td>
					<input type="text" name="id" id="id">
				</td>
			</tr>
			<tr>
				<th>패스워드</th>
				<td><input type="password" name="pw"></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<input type="submit" value="로그인">
					<a href="memberin"><input type="button" value="회원가입"></a>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h3 align="center">상품입력</h3>
	<form action="spsave" method="post" enctype="multipart/form-data">
		<table border="1" align="center">
			<tr>
				<th>상품명</th>
				<td><input type="text" name="spname"></td>
			</tr>
			<tr>
				<th>상호</th>
				<td><input type="text" name="company"></td>
			</tr>
			<tr>
				<th>구입일자</th>
				<td><input type="date" name="buyday"></td>
			</tr>
			<tr>
				<th>가격</th>
				<td><input type="text" name="price"></td>
			</tr>
			<tr>
				<th>이미지</th>
				<td><input type="file" name="picture"></td>
			</tr>
			<tr>
				<th>특징</th>
				<td><input type="text" name="cha"></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<input type="submit" value="전송">
				</td>
			</tr>
		</table>
	</form>
</body>
</html>

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h3 align="center">상품출력</h3>
	<table border="1" align="center" width="800px">
		<tr>
			<th>상품번호</th><th>상품명</th><th>상호</th>
			<th>가격</th><th>구입날짜</th><th>조회수</th>
		</tr>
		<c:forEach items="${list}" var="list">
		<tr>
			<td>${list.num}</td>
			<td><a href="spout2?spname=${list.spname}">
				<c:if test="${list.indent >= 1}">
				<c:forEach var="i" begin="1" end="${list.indent}">&emsp;</c:forEach>
				</c:if>
				${list.spname}
				</a>
			</td>
			<td>${list.company}</td>
			<td>
			<fmt:formatNumber value="${list.price}" pattern="#,##0"/>
			</td>
			<td>
				<c:set var="buyday" value="${list.buyday}"/>
				${fn:substring(buyday,0,10)}
			</td>
			<td>${list.readcnt}</td>
		</tr>
		</c:forEach>
	</table>
</body>
</html>

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h3 align="center">상품출력2</h3>
	<form action="reply">
		<input type="hidden" name="num" value="${dto.num}">
		<table border="1" align="center" width="800px">
			<tr>
				<th>상품명</th><th>상품이미지</th><th>특징</th><th>조회수</th>
			</tr>
			<tr>
				<td>${dto.spname}</td>
				<td>
					<a href="spout">
						<img src="resources/${dto.picture}" width="240px" height="240px">
					</a>
				</td>
				<td>${dto.cha}</td><td>${dto.readcnt}</td>
			</tr>
			<tr>
				<td colspan="3" align="center">
					<input type="submit" value="댓글달기">
				</td>
			</tr>
		</table>
	</form>
</body>
</html>

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h3 align="center">댓글입력</h3>
	<form action="replysave" method="post" enctype="multipart/form-data">
		<input type="hidden" name="groups" value="${dto.groups}">
		<input type="hidden" name="step" value="${dto.step}">
		<input type="hidden" name="indent" value="${dto.indent}">
		<table border="1" align="center">
			<tr>
				<th>상품명</th>
				<td><input type="text" name="spname"></td>
			</tr>
			<tr>
				<th>상호</th>
				<td><input type="text" name="company"></td>
			</tr>
			<tr>
				<th>구입일자</th>
				<td><input type="date" name="buyday"></td>
			</tr>
			<tr>
				<th>가격</th>
				<td><input type="text" name="price"></td>
			</tr>
			<tr>
				<th>이미지</th>
				<td><input type="file" name="picture"></td>
			</tr>
			<tr>
				<th>특징</th>
				<td><input type="text" name="cha"></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<input type="submit" value="전송">
				</td>
			</tr>
		</table>
	</form>
</body>
</html>

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h3 align="center">상품검색</h3>
	<form action="spsearchout">
		<table border="1" align="center">
			<tr>
				<th>구분</th>
				<td>
					<select name="items">
						<option value="spname">상품명
						<option value="company">상호
					</select>
				</td>
			</tr>
			<tr>
				<th>값</th>
				<td><input type="text" name="value"></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<input type="submit" value="검색">
				</td>
			</tr>
		</table>
	</form>
</body>
</html>

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
	<definition name="baseLayout" template="/WEB-INF/views/layout.jsp">
		<put-attribute name="title" value=""/>
		<put-attribute name="top" value="/WEB-INF/views/top.jsp"/>
		<put-attribute name="body" value=""/>
		<put-attribute name="footer" value="/WEB-INF/views/footer.jsp"/>
	</definition>	   
	<definition name="main" extends="baseLayout">
		<put-attribute name="title" value="메인화면"/>
		<put-attribute name="body" value="/WEB-INF/views/main.jsp"/>
	</definition>  
	<definition name="memberinput" extends="baseLayout">
		<put-attribute name="title" value="회원가입"/>
		<put-attribute name="body" value="/WEB-INF/views/member/memberinput.jsp"/>
	</definition> 
	<definition name="logininput" extends="baseLayout">
		<put-attribute name="title" value="로그인"/>
		<put-attribute name="body" value="/WEB-INF/views/member/logininput.jsp"/>
	</definition> 
	<definition name="spinput" extends="baseLayout">
		<put-attribute name="title" value="상품입력"/>
		<put-attribute name="body" value="/WEB-INF/views/sp/spinput.jsp"/>
	</definition> 
	<definition name="spoutput" extends="baseLayout">
		<put-attribute name="title" value="상품출력"/>
		<put-attribute name="body" value="/WEB-INF/views/sp/spoutput.jsp"/>
	</definition> 
	<definition name="spoutput2" extends="baseLayout">
		<put-attribute name="title" value="상품출력2"/>
		<put-attribute name="body" value="/WEB-INF/views/sp/spoutput2.jsp"/>
	</definition> 
	<definition name="replyinput" extends="baseLayout">
		<put-attribute name="title" value="댓글입력"/>
		<put-attribute name="body" value="/WEB-INF/views/sp/replyinput.jsp"/>
	</definition> 
	<definition name="spsearch" extends="baseLayout">
		<put-attribute name="title" value="상품검색"/>
		<put-attribute name="body" value="/WEB-INF/views/sp/spsearch.jsp"/>
	</definition> 
</tiles-definitions>

package com.ezen.kim18_001.member;

public class MemberDTO {
	String id,pw,name;
	public MemberDTO() {
	}
	public MemberDTO(String id, String pw, String name) {
		super();
		this.id = id;
		this.pw = pw;
		this.name = name;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getPw() {
		return pw;
	}
	public void setPw(String pw) {
		this.pw = pw;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}

 

package com.ezen.kim18_001.member;

public interface Service1 {
	public void insert(String id,String pw,String name);
	public String idcheck(String id);
	public MemberDTO logincheck(String id,String pw);
}

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
    "https://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.ezen.kim18_001.member.Service1">
	<insert id="insert">
		insert into member0316 values (#{param1},#{param2},#{param3})
	</insert>
	<select id="idcheck" resultType="String">
		select count(*) from member0316 where id=#{param1}
	</select>
	<select id="logincheck" resultType="com.ezen.kim18_001.member.MemberDTO">
		select * from member0316 where id=#{param1} and pw=#{param2}
	</select>
</mapper>

 

package com.ezen.kim18_001.member;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

@Controller
public class MemberController {
	@Autowired
	SqlSession sqlSession;
	
	@RequestMapping(value="/memberin") 
	public String ko1() {
		return "memberinput";
	}
	@RequestMapping(value="/membersave")
	public String ko2(HttpServletRequest request) {
		String id = request.getParameter("id");
		String pw = request.getParameter("pw");
		String name = request.getParameter("name");
		Service1 ss1 = sqlSession.getMapper(Service1.class);
		ss1.insert(id,pw,name);
		return "redirect:memberin";
	}
	@ResponseBody
	@RequestMapping(value="/idcheck")
	public String ko3(String id) {
		Service1 ss1 = sqlSession.getMapper(Service1.class);
		String cnt = ss1.idcheck(id);
		return cnt;
	}
	@RequestMapping(value="/loginin") 
	public String ko4() {
		return "logininput";
	}
	@RequestMapping(value="/logincheck")
	public String ko5(HttpServletRequest request,RedirectAttributes ra) {
		String id = request.getParameter("id");
		String pw = request.getParameter("pw");
		Service1 ss1 = sqlSession.getMapper(Service1.class);
		MemberDTO dto = ss1.logincheck(id,pw);
		HttpSession hs = request.getSession();
		if(dto != null) {
			hs.setAttribute("dto", dto);
			hs.setAttribute("login", true);
		}
		else {
			hs.setAttribute("login", false);
			ra.addAttribute("result", "loginfail");
			return "redirect:loginin";
		}
		return "main";
	}
	@RequestMapping(value="/logout")
	public String ko6(HttpServletRequest request) {
		HttpSession hs = request.getSession();
		hs.removeAttribute("dto");
		hs.removeAttribute("login");
		hs.setAttribute("login", false);
		return "main";
	}
}

package com.ezen.kim18_001.sp;

public class SpDTO {
	int num;
	String spname,company,buyday;
	int price;
	String picture,cha;
	int readcnt,groups,step,indent;
	public SpDTO() {
	}
	public SpDTO(int num, String spname, String company, String buyday, int price, String picture, String cha,
			int readcnt, int groups, int step, int indent) {
		super();
		this.num = num;
		this.spname = spname;
		this.company = company;
		this.buyday = buyday;
		this.price = price;
		this.picture = picture;
		this.cha = cha;
		this.readcnt = readcnt;
		this.groups = groups;
		this.step = step;
		this.indent = indent;
	}
	public int getNum() {
		return num;
	}
	public void setNum(int num) {
		this.num = num;
	}
	public String getSpname() {
		return spname;
	}
	public void setSpname(String spname) {
		this.spname = spname;
	}
	public String getCompany() {
		return company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getBuyday() {
		return buyday;
	}
	public void setBuyday(String buyday) {
		this.buyday = buyday;
	}
	public int getPrice() {
		return price;
	}
	public void setPrice(int price) {
		this.price = price;
	}
	public String getPicture() {
		return picture;
	}
	public void setPicture(String picture) {
		this.picture = picture;
	}
	public String getCha() {
		return cha;
	}
	public void setCha(String cha) {
		this.cha = cha;
	}
	public int getReadcnt() {
		return readcnt;
	}
	public void setReadcnt(int readcnt) {
		this.readcnt = readcnt;
	}
	public int getGroups() {
		return groups;
	}
	public void setGroups(int groups) {
		this.groups = groups;
	}
	public int getStep() {
		return step;
	}
	public void setStep(int step) {
		this.step = step;
	}
	public int getIndent() {
		return indent;
	}
	public void setIndent(int indent) {
		this.indent = indent;
	}
}

 

package com.ezen.kim18_001.sp;

import java.util.ArrayList;

public interface Service2 {
	public void insert(String spname,String company,String buyday,int price,String picture,String cha);
	public ArrayList<SpDTO> out();
	public void readcnt(String spname);
	public SpDTO out2(String spname);
	public SpDTO reply(int num);
	public void stepup(int groups,int step);
	public void replyinsert(String spname,String company,String buyday,int price,String picture,String cha,int groups,int step,int indent);
	public ArrayList<SpDTO> searchspname(String value);
	public ArrayList<SpDTO> searchcompany(String value);
}

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
    "https://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.ezen.kim18_001.sp.Service2">
	<insert id="insert">
		insert into sp0316 (num,spname,company,buyday,price,picture,cha,groups) 
		values (num0316_SEQ.nextval,#{param1},#{param2},#{param3},#{param4},#{param5},#{param6},num0316_SEQ.currval)
	</insert>
	<select id="out" resultType="com.ezen.kim18_001.sp.SpDTO">
		select * from sp0316 order by groups desc,step asc
	</select>
	<update id="readcnt">
		update sp0316 set readcnt=readcnt+1 where spname = #{param1}
	</update>
	<select id="out2" resultType="com.ezen.kim18_001.sp.SpDTO">
		select * from sp0316 where spname = #{param1}
	</select>
	<select id="reply" resultType="com.ezen.kim18_001.sp.SpDTO">
		select * from sp0316 where num = #{param1}
	</select>
	<update id="stepup">
		update sp0316 set step=step+1 where groups=#{param1} and step>#{param2}
	</update>
	<insert id="replyinsert">
		insert into sp0316 (num,spname,company,buyday,price,picture,cha,groups,step,indent) 
		values (num0316_SEQ.nextval,#{param1},#{param2},#{param3},#{param4},#{param5},#{param6},#{param7},#{param8},#{param9})
	</insert>
	<select id="searchspname" resultType="com.ezen.kim18_001.sp.SpDTO">
		select * from sp0316 where spname like '%'||#{param1}||'%'
	</select>
	<select id="searchcompany" resultType="com.ezen.kim18_001.sp.SpDTO">
		select * from sp0316 where company like '%'||#{param1}||'%'
	</select>
</mapper>

 

package com.ezen.kim18_001.sp;

import java.io.File;
import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

@Controller
public class SpController {
	@Autowired
	SqlSession sqlSession;
	
	@RequestMapping(value="/spin")
	public String ko1() {
		return "spinput";
	}
	@RequestMapping(value="/spsave",method = RequestMethod.POST)
	public String ko2(MultipartHttpServletRequest mul) throws Exception {
		String spname = mul.getParameter("spname");
		String company = mul.getParameter("company");
		String buyday = mul.getParameter("buyday");
		int price = Integer.parseInt(mul.getParameter("price"));
		MultipartFile mf = mul.getFile("picture");
		String picture = mf.getOriginalFilename();
		String path = "C:\\12월국비\\spring\\day18_001\\src\\main\\webapp\\resources";
		mf.transferTo(new File(path,picture));
		String cha = mul.getParameter("cha");
		Service2 ss2 = sqlSession.getMapper(Service2.class);
		ss2.insert(spname,company,buyday,price,picture,cha);
		return "redirect:spin";
	}
	@RequestMapping(value="/spout")
	public String ko3(Model mo) {
		Service2 ss2 = sqlSession.getMapper(Service2.class);
		ArrayList<SpDTO> list = ss2.out();
		mo.addAttribute("list", list);
		return "spoutput";
	}
	@RequestMapping(value="/spout2")
	public String ko4(HttpServletRequest request,Model mo) {
		Service2 ss2 = sqlSession.getMapper(Service2.class);
		String spname = request.getParameter("spname");
		ss2.readcnt(spname);
		SpDTO dto = ss2.out2(spname);
		mo.addAttribute("dto", dto);
		return "spoutput2";
	}
	@RequestMapping(value="/reply")
	public String ko5(HttpServletRequest request,Model mo) {
		Service2 ss2 = sqlSession.getMapper(Service2.class);
		int num = Integer.parseInt(request.getParameter("num"));
		SpDTO dto = ss2.reply(num);
		mo.addAttribute("dto", dto);
		return "replyinput";
	}
	@RequestMapping(value="/replysave",method = RequestMethod.POST)
	public String ko6(MultipartHttpServletRequest mul) throws Exception {
		int groups = Integer.parseInt(mul.getParameter("groups"));
		int step = Integer.parseInt(mul.getParameter("step"));
		int indent = Integer.parseInt(mul.getParameter("indent"));
		String spname = mul.getParameter("spname");
		String company = mul.getParameter("company");
		String buyday = mul.getParameter("buyday");
		int price = Integer.parseInt(mul.getParameter("price"));
		MultipartFile mf = mul.getFile("picture");
		String picture = mf.getOriginalFilename();
		String path = "C:\\12월국비\\spring\\day18_001\\src\\main\\webapp\\resources";
		mf.transferTo(new File(path,picture));
		String cha = mul.getParameter("cha");
		Service2 ss2 = sqlSession.getMapper(Service2.class);
		ss2.stepup(groups, step);
		step++;
		indent++;
		ss2.replyinsert(spname,company,buyday,price,picture,cha,groups,step,indent);
		return "redirect:spout";
	}
	@RequestMapping(value="/spsearch")
	public String ko7() {
		return "spsearch";
	}
	@RequestMapping(value="/spsearchout")
	public String ko8(HttpServletRequest request,Model mo) {
		Service2 ss2 = sqlSession.getMapper(Service2.class);
		String items = request.getParameter("items");
		String value = request.getParameter("value");
		ArrayList<SpDTO> list;
		if(items.equals("spname")) {
			list = ss2.searchspname(value);
		}
		else {
			list = ss2.searchcompany(value);
		}
		mo.addAttribute("list", list);
		return "spoutput";
	}
}

 

'SPRING' 카테고리의 다른 글

230320_Git  (0) 2023.03.20
230317_게시판  (0) 2023.03.17
230315_게시판  (0) 2023.03.15
230314_게시판  (0) 2023.03.14
230313_게시판  (0) 2023.03.13

댓글