앱)java springframework select box jstl form sample 예제
<form name="searchForm" id="searchForm" method="post">
<select name="statusCode" id="statusCode" style="width:208px;" class="select">
<option value="">ALL</option>
<option value="R">R</option>
<option value="R">R</option>
<option value="R">R</option>
<option value="R">R</option>
</select>
<select name="status" id="status">
<option value="">ALL</option>
<c:if test="${null != stsCdList && !empty stsCdList}">
<c:forEach var="stsCdList" items="${stsCdList}">
<option value="${stsCdList.code}">${stsCdList.codeName}</option>
</c:forEach>
</c:if>
</select>
<select id="useType" name="useType" style="width:200px;">
<c:if test="${null != useTpCdList && !empty useTpCdList}">
<c:forEach var="useTpCdList" items="${useTpCdList}">
<c:if test="${useTpCdList.code != 'M' && useTpCdList.code != 'P'}">
<option value="${useTpCdList.code}">${useTpCdList.codeName}</option>
</c:if>
</c:forEach>
</select>
<select class="select" name="historySelect" id="historySelect" onchange="showView()" style="width:150px;height:23px;">
<option value="kkkk" <c:if test="${historyType eq 'kkkk'}">selected</c:if>>History</option>
<option value="pppp" <c:if test="${historyType eq 'pppp'}">selected</c:if>>History</option>
</select>
</form>
function showView(){
var selectVal = $('#historySelect').val();
if(selectVal == "kkkk") {
$.ajax({
url : "<c:url value='/showView.do' />",
type: 'post',
beforSend : function(xhr) {
xhr.setRequestHeader("AJAX","true");
},
data : {
key : "${}",
key2 : "D"
},
contentType : "application/x-www-form-urlencoded; charset=UTF-8",
success : function(data) {
$('#dkfkjf').val();
$('#dfkjfk').html(data);
},
error : function(xhr, status, err){
if(xhr.status==403) {
location.href="<c:url value='/login/intro.do' />";
}
}
});
}
}
@RequestMapping(value = "/showView", method = {RequestMethod.POST})
public ModelAndView showView(HttpServletRequest request, HttpServletResponse response){
ModelAndView view = new ModelAndView();
int pageNo = ParamUtil.param(request,"pageNo",null) == null? 1: Integer.parseInt(ParamUtil.param(request,"pageNo", null));
view.addObject("key", keyObject);
view.setViewName("kkkk/kkkk");
return view;
}
<select name="statusCode" id="statusCode" style="width:208px;" class="select">
<option value="">ALL</option>
<option value="R">R</option>
<option value="R">R</option>
<option value="R">R</option>
<option value="R">R</option>
</select>
<select name="status" id="status">
<option value="">ALL</option>
<c:if test="${null != stsCdList && !empty stsCdList}">
<c:forEach var="stsCdList" items="${stsCdList}">
<option value="${stsCdList.code}">${stsCdList.codeName}</option>
</c:forEach>
</c:if>
</select>
<select id="useType" name="useType" style="width:200px;">
<c:if test="${null != useTpCdList && !empty useTpCdList}">
<c:forEach var="useTpCdList" items="${useTpCdList}">
<c:if test="${useTpCdList.code != 'M' && useTpCdList.code != 'P'}">
<option value="${useTpCdList.code}">${useTpCdList.codeName}</option>
</c:if>
</c:forEach>
</select>
<select class="select" name="historySelect" id="historySelect" onchange="showView()" style="width:150px;height:23px;">
<option value="kkkk" <c:if test="${historyType eq 'kkkk'}">selected</c:if>>History</option>
<option value="pppp" <c:if test="${historyType eq 'pppp'}">selected</c:if>>History</option>
</select>
</form>
function showView(){
var selectVal = $('#historySelect').val();
if(selectVal == "kkkk") {
$.ajax({
url : "<c:url value='/showView.do' />",
type: 'post',
beforSend : function(xhr) {
xhr.setRequestHeader("AJAX","true");
},
data : {
key : "${}",
key2 : "D"
},
contentType : "application/x-www-form-urlencoded; charset=UTF-8",
success : function(data) {
$('#dkfkjf').val();
$('#dfkjfk').html(data);
},
error : function(xhr, status, err){
if(xhr.status==403) {
location.href="<c:url value='/login/intro.do' />";
}
}
});
}
}
@RequestMapping(value = "/showView", method = {RequestMethod.POST})
public ModelAndView showView(HttpServletRequest request, HttpServletResponse response){
ModelAndView view = new ModelAndView();
int pageNo = ParamUtil.param(request,"pageNo",null) == null? 1: Integer.parseInt(ParamUtil.param(request,"pageNo", null));
view.addObject("key", keyObject);
view.setViewName("kkkk/kkkk");
return view;
}
'백엔드개발 > 자바스프링' 카테고리의 다른 글
앱)java spring framework excel export jstl (0) | 2018.06.11 |
---|---|
앱)jsp jstl jquery basic structure sample 기본 템플릿 (0) | 2018.06.11 |
앱)logback 한줄 로그 나오게 하는 방법 (0) | 2018.06.08 |
앱)AWS S3 Util java spring 예제 샘플 (0) | 2018.06.08 |
앱)자바 batch pid 파일 만들기 (0) | 2018.04.27 |