hanker

[NEXACRO N V24] Spring framework 데이터 통신 방법 본문

TOOL/nexacro

[NEXACRO N V24] Spring framework 데이터 통신 방법

hanker 2025. 6. 5. 03:14
반응형

넥사크로 N v24에서 Spring framework와 통신하는 방법에 대해서 알아보자.

 

Spring에서 설정을 선행해야 하는데, 아래 URL에서 따라 하면 된다.

https://www.playnexacro.com/#show:learn:4732

 

play nexacro:플레이 넥사크로

Play Nexacro is a community site for nexacro platform. 넥사크로 플랫폼 사용자 커뮤니티

www.playnexacro.com

 


1. Nexacro → Spring Framework

 

넥사크로 내에서 Spring에 URL을 호출시켜 데이터를 받아보자.

// 1번 클릭
this.form.btnSearch_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
    // 2번 callMethod 호출
	this.callMethod();
};

// 3번 callMethod 실행
this.callMethod = function () 
{
    // Parameter 셋팅
	this.ds_search.clearData();
	var nRow = this.ds_search.addRow();
	this.searchParams.setColumn(nRow, "fromDt", this.form.fromDt.value);
	this.searchParams.setColumn(nRow, "toDt", this.form.toDt.value);


	var sId    = "callList"; // 트랜잭션 구분 값 (ID)
	var sUrl   = "http://localhost:8080/html/callDataSet.do"; // 요청 주소
	var sInDs  = "params=searchParams"; // 파라미터 DataSet
	var sOutDs = "dataSet1=outDataset"; // return 값 Setting
	var sArg   = ""; // 요청 보낼 때 변수를 문자열로 설정해서 전송
	var sfunc  = "fn_callback"; // 콜백 함수 설정
	var bIsAsync = true; // 동기 비동기 처리 true : 비동기
	var dType = 3; // Type 지정 (0: XML, 1 : Binary, 2: SSV, 3: JSON)
	
    // 4번 Spring framework URL 통신
	this.transaction(sId,sUrl,sInDs,sOutDs,sArg,sfunc, bIsAsync, dType);
}

// 5번 transaction 호출 이후 콜백함수 실행
this.fn_callback = function(sId, nErrCd, sErrMsg)
{
    if (nErrCd == 0) {
		// 성공 시 처리 등
    } else {
        // 에러 처리 등
    }
};
  • searchParams와 dataSet1이라는 DataSet1이 설정되어 있어야 한다.

 

 

 


2. Spring Framework → Nexacro

 

    @RequestMapping("/html/callDataSet.do")
    public NexacroResult callDataSet(@ParamDataSet(name = "params") Map<String, Object> param) {

        List<Map<String, Object>> list = testService.getData(param);
        
        NexacroResult result = new NexacroResult();
        result.addDataSet("outDataset", list);

        return result;
    }

여기까지 완료되면 Nexacro로 보내준다.

 

 

반응형