반응형
https://genesis8.tistory.com/214
DAO / VO / DTO란?
원본 출처 : http://lbass.tistory.com/entry/DAO-%EB%9E%80 http://choijaehyuk.com/128 http://everyit.tistory.com/4 DAO란 Data Access Object의 약어로서 실질적으로 DB에 접근하는 객체를 말한다. DAO의..
genesis8.tistory.com
DAO =DTO ?
<select id="mailDAO.selectCompanyGroupUserList" parameterClass="java.util.HashMap" resultClass="egovMap">
/* 메일 주소록 조회 : mailDAO.selectCompanyGroupUserList */
SELECT
AA.USER_NM
, AA.EMAIL
, ISNULL(AA.GROUP_NM, '-') AS GROUP_NM
, AA.MAIL_GRP_IDX
, AA.GRP_USER_COMP
FROM(
대충 쿼리 문 !!
</select>
Service
public List<?> selectCompanyGroupUserList(HashMap<String, Object> paramMap) throws Exception;
DAO
public List<?> selectCompanyGroupUserList(HashMap<String, Object> paramMap) {
return list("mailDAO.selectCompanyGroupUserList", paramMap);
}
Controller
@RequestMapping(value = "ntb/mail/GetallCompanyaddrList.json")
@ResponseBody
public List<?> GetallCompanyaddrList(ModelMap model, HttpServletRequest request, HttpSession httpSession,@ModelAttribute("MailVO") MailVO vo)
throws Exception {
HashMap<String, Object> paramMap = new HashMap<String, Object>();
//세션정보 호출
SessionVO userSession = (SessionVO) request.getSession().getAttribute("SessionVO");
String mailAddr = userSession.getEmail();
vo.setMailAddr(mailAddr);
List<?> addrGroupList = mailService.selectMailAddrGroupList(vo);
String schEmail = request.getParameter("schEmail");
String schGrpIdx = request.getParameter("schGrpIdx");
String toFlg = request.getParameter("toFlg");
paramMap.put("mailAddr", mailAddr);
paramMap.put("schEmail", schEmail);
paramMap.put("schGrpIdx", schGrpIdx);
// 이메일 리스트 조회
List<?> resultList = mailService.selectCompanyGroupUserList(paramMap);
System.out.println("이건 GET 방식으로 받을 ajax data : " + resultList);
return resultList;
}
<div><input type="button" id="btn3" class="btn btn-default" value="클릭" /></div>
$('#btn3').click(function() {
alert("테스트 클릭성공");
gubnData = 'T';
$.ajax({
type: 'GET',
url: "/ntb/mail/GetallCompanyaddrList.json",
dataType: "json",
success: function(data) {
$(data).each(function(index, item) {
makeMailHTML(item.email, 'T', item.userNm);
$("#toTextarea").val('');
});
}
});
alert("테스트 ajax 성공");
});
반응형
function makeMailHTML(val, gubun, user) {
var textAreaVal = "";
var textAreaView = "";
if(user == '' || typeof user == "undefined" ){
user = '';
}else{
user = user.replace(/ /g," ").replace(/"/g,"");
}
if(gubun == "T") {
if(val == "") {
textAreaVal = $('#toTextarea').val();
textAreaView = textAreaVal;
} else {
textAreaVal = val;
textAreaView = " <" + textAreaVal + ">";
}
if(!cf_chkTxtEmailFormat(textAreaVal)) {
alert("이메일 형식이 맞지 않습니다.");
$('#toTextarea').focus();
return;
}
//받아온 데이터 값들이 여기에서 형식에 맞게 올라오네
$('#toTextarea').before('<div style="display: inline-block; overflow: hidden; position: relative; max-width: 390px; height: 21px; border: 1px solid #7bb2f5; vertical-align: top; margin-right: 2px;">' +
'<em style="display: block; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; overflow: hidden; float: left; margin-top: 2px;"></em>' +
'<button type="button" style="position: relative; top: 0; right: 0; height: 20px; margin-left: 5px; margin-top: 1.5px;">' +
'<img style="padding-right: 5px;" alt="삭제" src="/images/com/mailDelete.png">' +
'</button>' +
'<input name="setMailAddrUser" type="hidden" value=""/>' +
'<input name="setMailAddr" type="hidden" value=""/>' +
'</div>'
);
$('.tableType1 tr td:eq(0) em:last()').text(user + textAreaView);
$('.tableType1 tr td:eq(0) div input[type=hidden]:last()').val(textAreaVal);
$('.tableType1 tr td:eq(0) div:last() input[type=hidden]:nth-last-child(2)').val(user+"/"+textAreaVal);
} else {
if(val == "") {
textAreaVal = $('#ccTextarea').val();
textAreaView = textAreaVal;
} else {
textAreaVal = val;
textAreaView = " <" + textAreaVal + ">";
}
if(!cf_chkTxtEmailFormat(textAreaVal)) {
alert("이메일 형식이 맞지 않습니다.");
$('#ccTextarea').focus();
return;
}
$('#ccTextarea').before('<div style="display: inline-block; overflow: hidden; position: relative; max-width: 390px; height: 21px; border: 1px solid #7bb2f5; vertical-align: top; margin-right: 2px;">' +
'<em style="display: block; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; overflow: hidden; float: left; margin-top: 2px;"></em>' +
'<button type="button" style="position: relative; top: 0; right: 0; height: 20px; margin-left: 5px; margin-top: 1.5px;">' +
'<img style="padding-right: 5px;" alt="삭제" src="/images/com/mailDelete.png">' +
'</button>' +
'<input name="setMailCcUser" type="hidden" value=""/>' +
'<input name="setMailCc" type="hidden" value=""/>' +
'</div>');
$('.tableType1 tr td:eq(1) em:last()').text(user + textAreaView);
$('.tableType1 tr td:eq(1) div input[type=hidden]:last()').val(textAreaVal);
$('.tableType1 tr td:eq(1) div:last() input[type=hidden]:nth-last-child(2)').val(user+"/"+textAreaVal);
}
}
jQuery UI autocomplete(입력필드 자동완성) 사용하기
입력 필드에 타이핑을 하면 관련 정보를 보여주고 선택할 수 있는 기능이 많이 사용됩니다. jQuery UI에서 제공되는 autocomplete 기능을 사용해서 이 기능을 구현해 봅니다. 1. 필요한 파일 인클루드
offbyone.tistory.com
https://kyhyuk.tistory.com/152
Spring 개발자 수업 105일차(1) - jQuery Ajax를 이용한 데이터 가져오기/보내기
jQuery Ajax를 이용한 데이터 가져오기/보내기 - 오늘은 ajax를 이용해서 데이터 주고 받는 페이지를 직접 만들어 보자. [ 준비 작업 ] 1. pom.xml - 자바, 스프링 버전 - Lombok - MyBatis - Log4j - Jackson - J..
kyhyuk.tistory.com
반응형
'Web Dev' 카테고리의 다른 글
Next.js HTML 파일 JSX 형식으로 변환하는 방법 (0) | 2023.10.13 |
---|---|
Node.js 백엔드에서 메일 전송하기 (with Nodemailer & Gmail) (0) | 2023.09.19 |
node.js NPM (Node.js Package Manager) feat. npm Error: Class extends value undefined is not a constructor or null 에러 해결 (0) | 2023.08.25 |
개발 초보가 기록한 Tomcat 톰캣 서버 웹페이지 배포하는 방법 (0) | 2023.07.19 |
CSS : <div class="overflow-hidden ..."></div> overflow-hidden 이 뭐지 ? (0) | 2023.06.22 |
Netlify 에 React.js Web 웹페이지 Deploy 배포 하는 방법 쉬워요! (0) | 2023.06.16 |