반응형

위의 예제 응용입니다 
<option value='t001' <%=topographyValue.equals("t001") ? "selected" : "" %> >어쩌구</option> 
혹은 
------------------------------------------------------- 
function setComboValue(obj, str){ 
var otype; //OBJECT TYPE 
if (obj == null) return ; 
if (chk_Blank(str)) return ; 
otype = (obj.type).substring(0,6); 

if (otype != "select") return ; 

for (var index = 0; index < obj.length; index++) { 
if (obj.options[index].value != '') { 
if (trim(obj.options[index].value) == trim(str)) { 
obj.options[index].selected = true; 

} else { 
if (trim(obj.options[index].text) == trim(str)) { 
obj.options[index].selected = true; 





공통 자바스크립트 펑션에 요너마 만들어 놓고 

<body onload="init()"> //body에 init() javascript호출후 

자바스크립트 정의하는곳에 요너마 낑겨 넣으삼 

function init(){ 
f = document.writeForm; //writeForm은 select박스를 둘러싼 form name 
setComboValue(f.topography, "<%=topographyValue%>"); 
}


okjsp 펌


실제 적용 부분...


<form id="form" name="form" method="post" enctype="multipart/form-data">


$(document).ready(function() {

init();

});

function init(){ 

setComboValue(form.bond_type, "<%=bond_type%>");

setComboValue(form.term, "<%=bond_term%>");

//셀렉트 박스 disabled

document.all['bond_type'].disabled = true;

document.all['term'].disabled = true;

}

function setComboValue(obj, str){ 

var otype; //OBJECT TYPE 

if (obj == null) return ; 

//if (chk_Blank(str)) return ; 

otype = (obj.type).substring(0,6); 

if (otype != "select") return ; 


for (var index = 0; index < obj.length; index++) { 

if (obj.options[index].value != '') { 

if (obj.options[index].value == str) { 

obj.options[index].selected = true;


} else { 

if (obj.options[index].text == str) { 

obj.options[index].selected = true; 

}



반응형
반응형

File.mkdir()

만들고자 하는 디렉토리의 상위 디렉토리가 존재하지 않을 경우생성 불가

C:\base\want

want 디렉토리를 만들고자 하는데, base 디렉토리가 없는 경우생성 불가

File.mkdirs()

만들고자 하는 디렉토리의 상위 디렉토리가 존재하지 않을 경우상위 디렉토리까지 생성

C:\base\want

want 디렉토리를 만들고자 하는데, base 디렉토리가 없는 경우, base 디렉토리까지 생성



삽을 푸는구나 퍼~ 

상위 디렉토리까지 만들려면 mkdirs() ...!!!!

반응형
반응형


제이 쿼리 라디오버튼 CSS 제어 하기

// 부모 자식 노드를 제어할때는 태그 닫고 열린걸 꼭 확인한다
<부모><자식></자식 닫기></부모닫기>

제어할때
$(this).children().addClass('active');             // 자식노드에 CSS 적용

$(this).parent('span').addClass('active');      // 부모노드에 CSS 적용


//라벨로 제어 할 때


<label for="radio-01" >

<input name="sample-radio" class="screen-out" id="radio-01">

<label for="radio-02" >

<input name="sample-radio" class="screen-out" id="radio-02">


ID를 매칭 시켜 주면 여러가지 컨트롤이 쉽다.


예) 라벨 범위 클릭 라디오 체크(제어) 된다...  


삽질삽질 ㅎㅎ


풀 소스 첨부합니다.


참고 url

http://webdesign.maratz.com/lab/fancy-checkboxes-and-radio-buttons/jquery.html


반응형
반응형

@Controller

public class ExcelController  extends ExceptionController {

@Autowired UserMngService userMngService;

//엑셀파일 변환 및 다운로드

   @RequestMapping("/excel_transform_controller")

   public Object  excelTransform(@RequestParam String target

    //,@RequestParam String branch_id

    ,Map<String,Object> ModelMap) throws Exception{

    //임시 .. 세션으로 할지 .. 히든으로 가져올지...

    String branch_id = "0112";

// 쿼리에 전달할 파라미터 설정             

HashMap<String, Object> param = new HashMap<String, Object>();

param.put("branch_id", branch_id);

param.put("target", target);



// 받아올 형태 Vo 설정 ( dao .. service.. ibatis 모두 맞춤)

/*

// 서비스 인터페이스

public List<ExcelVo> getAllObjects(Map<String, Object> param);

// service 구현

public List<ExcelVo> getAllObjects(Map<String, Object> param){

return (List<ExcelVo>) sqlMapClientTemplate.queryForList("idExcell", param);

}

// ibatis 부분

    <select id="idExcel" resultClass="패키지경로.ExcelVo" parameterClass="java.util.Map">

SELECT name from table...

   </select>

*/


// vo 형태 맞춰 리스트 가져옴

    List<ExcelVo>  excelList = userMngService.getAllObjects(param);


// ModelMap 에 풋풋

   ModelMap.put("excelList", excelList);

   ModelMap.put("target", target);    

   

            /*  // 잘 가져오나 한번 테스트 ~~ 

List<ExcelVo> list = (List<ExcelVo>)ModelMap.get("excelList");

System.out.println("  list ===== "+ list.size());         

            for(int i=0;i<list.size();i++){

            System.out.println("=============" + list.get(i).getUser_type_id());      

    System.out.println("=============" + list.get(i).getName() );

    }

            

            return null;

*/

   return "excelView";


   }

}


리턴 받을 곳에서  사용한건  servlet-context.xml --- >  BeanNameViewResolver


<beans:bean class="org.springframework.web.servlet.view.BeanNameViewResolver">

<beans:property name="order" value="0"/>

</beans:bean> 

<beans:bean id="excelView" class="패키지경로.ExcelView" />


반응형
반응형

---  header.jsp ---


<script type="text/javascript">

    var ctx = "${pageContext.request.contextPath}";

    var ServerIP = "${pageContext.request.serverName}";           // 서버 ip

var ServerPort = "${pageContext.request.serverPort}";         // 서버 port

</script>


-- sucess.jsp ---

<%@ page language="java" contentType="text/html; charset=UTF-8"%>

<%@ include file="/WEB-INF/jsp/pb/include/taglibs.jsp" %>

<%

   

%>

<html>

<head>

<c:import url="/WEB-INF/jsp/pb/include/header.jsp" />

    <title>NICE신용평가정보 - CheckPlus 본인인증 테스트</title>

    <script type="text/javascript">

    var test = 'http://'+ServerIP+ ':' +ServerPort+'/m/member/member_join_step6';

    alert(test);

    opener.parent.location='http://'+ServerIP+ ':' +ServerPort+'/m/member/member_join_step6';

    window.close(); 

    </script>

 

</head>

<body>


</body>

</html>



간단히 '' + +'' + '' ... 이게 왜 할때 마다 햇갈리지 아오아오


그리고 jsp 에서 서버 아이피 , 서버 포트 가져오기


String strServerIP = request.getServerName();                             // 서버 ip

String strServerPort = Integer.toString(request.getServerPort());         // 서버 port


String sReturnUrl= "http://"+strServerIP+":"+strServerPort+ "/success";      // 성공시 이동될 URL

String sErrorUrl = "http://"+strServerIP+":"+strServerPort+ "/checkplus_fail";         // 실패시 이동될 URL

반응형
반응형

poi  관련 url


http://javaclass1.tistory.com/149

spring 설정으로 액셀 다운로드


http://stackoverflow.com/questions/14740727/upload-excel-file-into-database-using-apache-poi-and-spring-framework

jsp 페이지 업로드 소스


http://blog.daum.net/kibbmcc/7718689

액셀 - 제어 관련


http://joke00.tistory.com/252
실제 업로드 가능 java 소스 jsp 페이지 말고 java 만 이용



반응형
반응형

 

날짜만 나와서 시간을 알아보고 싶었다..

 

검색 해보니 아래 쿼리 ...

 

ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD:HH24:MI:SS';

 

위 실행 후

 

select sysdate from dual;

 

2013-10-11:17:27:34

 

정상 적으로 나온다 ~ ㅎㅎㅎ

반응형
반응형


/* 폼 입력값 Check*/
function frmchk_char(str, condition)
/*
설명  : 폼 입력값을 정규식패턴을 이용해서 체크함
사용법 : frmchk_char(문자열, 조건)
결과값 : true/false
조건  : 
 0 = 첫글자 영문, 영문, 숫자, _ 사용가능
 1 = 영문만 사용가능
 2 = 숫자만 사용가능
 3 = 한글만 사용가능
 4 = 영문, 숫자 사용가능
 5 = 영문, 숫자, 한글 사용가능
 6 = 한글, 숫자 사용가능
 7 = 한글, 영문 사용가능
 8 = 한글을 포함하는지 여부
*/
{
 var objPattern
 switch(condition){
  case(0) :
   objPattern = /^[a-zA-Z]{1}[a-zA-Z0-9_]+$/;
   break;
  case(1) :
   objPattern = /^[a-zA-Z]+$/;
   break;
  case(2) :
   objPattern = /^[0-9]+$/;
   break;
  case(3) :
   objPattern = /^[가-힣]+$/;
   break;
  case(4) :
   objPattern = /^[a-zA-Z0-9]+$/;
   break;
  case(5) :
   objPattern = /^[가-힣a-zA-Z0-9]+$/;
   break;
  case(6) :
   objPattern = /^[가-힣0-9]+$/;
   break;
  case(7) :
   objPattern = /^[가-힣a-zA-Z]+$/;
   break;
  case(8) :
   objPattern = /[가-힣]/;
 }
 return objPattern.test(str);
}

반응형
반응형

아오 뭔일이지..


급한대로


시작 - 실행 CTFMON.exe 실행 후 해결


ctfmon.exe

반응형
반응형

import java.io.DataInputStream;

import java.io.IOException;

import java.io.OutputStream;

import java.net.Socket;

import java.text.SimpleDateFormat;


import org.springframework.context.support.ClassPathXmlApplicationContext;


public class TaskThread implements Runnable {


    private Socket clientSocket;

    private String lineBreak = System.getProperty("line.separator");

    private StringBuffer log = new StringBuffer();

    

    public void run() {

        String messageForClient = "";

        

        try {

            saveLog("[Client Socket Address : " + clientSocket.getRemoteSocketAddress() + "]");

            saveLog("[Client Request Time   : " + getRequestTime() + "]");

           

            String clientData = getData();

            saveLog("[Client Data           : " + clientData + "]");

            messageForClient = Dispatcher.execute(clientData);

            saveLog("[Return Data           : " + messageForClient + "]");

        }

        catch(IOException i) {

            saveErrorLog(i.getMessage());

        }

        catch(Exception e) {

            saveErrorLog(e.getMessage()); 

        }

        finally {

            try {

                sendData(messageForClient);

            } 

            catch (IOException e) {

                saveErrorLog("클라이언트 전송 오류 : " + e.getMessage());  

            }

            finally {

                try {

                    clientSocket.close();

                } 

                catch (IOException e) {

                    saveErrorLog("소켓 close 오류 : " + e.getMessage());      

                }

            }

           

            System.out.println(log.toString());

            saveLogInDb();

        }

    }

    

    private void saveLogInDb() {

        

    }

    

    private void sendData(String stringData) throws IOException {

        OutputStream out = null;

        try {

            out = clientSocket.getOutputStream();

            byte[] datas = stringData.getBytes("euc-kr");

            out.write(datas);

        }

        catch(IOException e) {

            

        }

        finally {

            if(out != null) {

                out.close();

            }

        }

    }

    

    private void saveErrorLog(String errMsg) {

        saveLog("[Error Message         : " + errMsg + "]" + lineBreak); 

    }

    

    private void saveLog(String content) {

        log.append(content + lineBreak);

    }

    

    private String getRequestTime() {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        java.util.Date now = new java.util.Date();

        return sdf.format(now);

    }

    

    public TaskThread(Socket clientSocket) {

        this.clientSocket = clientSocket;

    }

    

    public String getData() throws IOException {

        DataInputStream dis = null;

        StringBuffer returnDataSb = new StringBuffer();

        saveLog("------------------------------------------------");

        

        try {

            dis = new DataInputStream(clientSocket.getInputStream());

            int count = 0;

            String macID  = "";

            String userID = "";

            String userPW = "";

            int MAC_ID_BYTES  = 50;

            int USER_ID_BYTES = 30;

            int USER_PW_BYTES = 64;

            

           if(dis.available() > 0) {

                byte[] macId  = new byte[MAC_ID_BYTES];

                byte[] userId = new byte[USER_ID_BYTES]; 

                byte[] userPw = new byte[USER_PW_BYTES];

                

                dis.read(macId);

                dis.read(userId);

                dis.read(userPw);

                

                macID  = new String(macId,  0, MAC_ID_BYTES).trim();

                userID = new String(userId, 0, USER_ID_BYTES).trim();

                userPW = new String(userPw, 0, USER_PW_BYTES).trim();

                

                saveLog("[Mac ID(" + macID.length() + ")] : " + macID);

                saveLog("[userID(" + userID.length() + ")] : " + userID);

                saveLog("[userPW(" + userPW.length() + ")] : " + userPW);

                

               /* dis.read(in,MAC_ID_BYTES,USER_ID_BYTES);

                userID = new String(in,MAC_ID_BYTES,USER_ID_BYTES);

                userID = userID.trim();

                dis.read(in,MAC_ID_BYTES + USER_ID_BYTES, USER_PW_BYTES);

                userPW = new String(in,MAC_ID_BYTES + USER_ID_BYTES, USER_PW_BYTES);

                userPW = userPW.trim();

                saveLog("[Mac ID] : " + macID);

                saveLog("[userID] : " + userID);

                saveLog("[userPW] : " + userPW);

                returnDataSb.append(macID + " " + userID + " " + userPW);*/

                returnDataSb.append(macID+"/"+userID+"/"+userPW+"/");

            }

            

            saveLog("------------------------------------------------");

            return returnDataSb.toString();

        }

        catch(IOException i) {

            throw i;

        }

        finally {

            if(dis != null) dis.close();

        }

    }

}



반응형

+ Recent posts