text
stringlengths 132
4.25k
|
---|
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>๋ฅ์ฌํฌ๋ก initdata.jsp ์ ์ฅ [/INST] initdata.jsp ํ์ผ์ ํธ์ถํ๋ฉด 'saveFile.bin'์ด๋ผ๋ ์ด๋ฆ์ ํ์ผ์ด ์์ฑ๋ฉ๋๋ค.
์์ฑ๋ ํ์ผ์ WAS(์์ ์์๋ ์ํ์น ํฐ์บฃ)์ ์ค์นํ ํด๋ ์๋์ ์์ฑ๋ฉ๋๋ค.
ํ:
ํน์ ๊ฒฝ๋ก์ ํ์ผ์ ์ ์ฅํ๊ณ ์ ํ๋ ๊ฒฝ์ฐ์๋ ์๋์ ๊ฐ์ด initdata.jsp ํ์ผ์ ์์ ํด ์ ์ฉํ ์ ์์ต๋๋ค.
[code]
//String targetFilename = "./saveFile.bin";
File targetFile = new File("c:/saveFile.bin");
OutputStream target = new FileOutputStream(targetFile);
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/initdata.jsp/์ ์ฅ๋ ํ์ผ </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>๋ฅ์ฌํฌ๋ก search.jsp pseudo code [/INST] [code]
// 1. ์๋ฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ง์ (Nexacro X-API ํฌํจ)
// 2. MIME Type ์ ์
// 3. Nexacro ๊ธฐ๋ณธ๊ฐ์ฒด(PlatformData) ์์ฑ
try {
// 4. Data ์ฒ๋ฆฌ
// 5. ErrorCode, ErrorMsg ์ฒ๋ฆฌํ๊ธฐ (์ฑ๊ณต ๋ฉ์์ง)
} catch (Error) {
// 5. ErrorCode, ErrorMsg ์ฒ๋ฆฌํ๊ธฐ (์คํจ ๋ฉ์์ง)
}
// 6. ๊ฒฐ๊ณผ Data Client์๊ฒ ๋ณด๋ด๊ธฐ
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/search.jsp/pseudo code </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>๋ฅ์ฌํฌ๋ก search.jsp ์์ฌ ์ฝ๋ [/INST] [code]
// 1. ์๋ฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ง์ (Nexacro X-API ํฌํจ)
// 2. MIME Type ์ ์
// 3. Nexacro ๊ธฐ๋ณธ๊ฐ์ฒด(PlatformData) ์์ฑ
try {
// 4. Data ์ฒ๋ฆฌ
// 5. ErrorCode, ErrorMsg ์ฒ๋ฆฌํ๊ธฐ (์ฑ๊ณต ๋ฉ์์ง)
} catch (Error) {
// 5. ErrorCode, ErrorMsg ์ฒ๋ฆฌํ๊ธฐ (์คํจ ๋ฉ์์ง)
}
// 6. ๊ฒฐ๊ณผ Data Client์๊ฒ ๋ณด๋ด๊ธฐ
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/search.jsp/pseudo code </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>๋ฅ์ฌํฌ๋ก ํ์ผ ๋ด์ฉ ์ฝ์ด์ ๋ฐ์ดํฐ์
์์ฑ [/INST] ./saveFile.bin' ํ์ผ์ ๋ด์ฉ์ ์ฝ์ด์ PlatformData ๊ฐ์ฒด์ ์ ์ฅํฉ๋๋ค. PlatformData ๊ฐ์ฒด์ Dataset์ด ๋ด๊ฒจ ์์ต๋๋ค.
ํ์ผ์์ ๋ด์ฉ์ ์ฝ์ด์ PlatformData์ ๋ด๋ ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
[code]
/** 4. Processing data: Loading data from the file: loading data from the file **/
/** 4.1 Loading data from the file **/
String sourceFilename = "./saveFile.bin";
InputStream source = new FileInputStream(sourceFilename);
PlatformRequest req = new PlatformRequest(source,
PlatformType.CONTENT_TYPE_BINARY);
req.receiveData();
source.close();
/** 4.2 Copying the loaded data to the dataset **/
pdata = req.getData();
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/search.jsp/์ฝ๋ ๊ตฌํ/File์ ๋ด์ฉ์ ์ฝ์ด์ Dataset ์์ฑํ๊ธฐ </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>XAPI search ์ฝ๋๊ตฌํ ๊ฒฐ๊ณผ๊ฐ Client์๊ฒ ๋ณด๋ด๊ธฐ [/INST] ์ด๊ธฐ๊ฐ์ด ์ ์์ ์ผ๋ก ํ์ผ์ ์ ์ฅ๋์๋์ง๋ฅผ ์ฌ์ฉ์์๊ฒ ์ ๋ฌํ๊ธฐ ์ํ์ฌ PlatformData ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํฉ๋๋ค. ์ด๋, ์์์ ์ ์ฅํ ErrorCode์ ErrorMsg๊ฐ ์ ๋ฌ๋ฉ๋๋ค.
search.jsp์์๋ PlatformData์ Client๊ฐ ์ฌ์ฉํ๋ ๋ช
ํจ๋ฆฌ์คํธ Dataset์ ๋ด๊ณ ์์ต๋๋ค.
VariableList๋ PlatformData์ ๋ฉค๋ฒ์ด๋ฏ๋ก ์ํ ๊ฒฐ๊ณผ๊ฐ์ PlatformData ๊ฐ์ฒด์ ๋ค์ด์์ต๋๋ค.
์ด์ PlatformData์ ๋ฐ์ดํฐ๋ฅผ ๋ฅ์ฌํฌ๋ก์์ ์ฒ๋ฆฌํ ์ ์๋ XML Format์ผ๋ก ์ถ์ถํ์ฌ ์ ์กํ๋ ๋ถ๋ถ์ ๊ตฌํํด ๋ณด๊ฒ ์ต๋๋ค.
๋ฐ์ดํฐ๋ฅผ ์ ์กํ๋ ๊ธฐ๋ฅ์ ์ฝ๊ฒ ๊ตฌํํ๊ธฐ ์ํด PlatformResponse ๊ฐ์ฒด๋ฅผ ๋ง๋ค๊ณ PlatformData ๊ฐ์ฒด์์ ๋ฐ์ดํฐ๋ฅผ ์ถ๋ ฅ์ํค๋ ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
[code]
/** 6. Sending result data to the client **/
HttpPlatformResponse res = new HttpPlatformResponse(response,
PlatformType.CONTENT_TYPE_XML,"UTF-8");
res.setData(pdata);
res.sendData();
์ ์์ ์ผ๋ก ๋ฐ์ดํฐ๊ฐ ์ฒ๋ฆฌ๋์๋ค๋ฉด ํด๋ผ์ด์ธํธ์๊ฒ ์ ๋ฌ๋๋ XML ๊ฐ์ ์๋์ ๊ฐ์ต๋๋ค.
[code]<Root xmlns="http://www.nexacro.com/platform/dataset" ver="5000">
<Parameters>
<Parameter id="ErrorCode" type="int">0</Parameter>
<Parameter id="ErrorMsg" type="string">SUCC</Parameter>
</Parameters>
<Dataset id="DatasetName">
<ColumnInfo>
/** Your ColumnInfo**/
<Column id="id" type="type" size="size"/>
</ColumnInfo>
<Rows>
<Row>
/** input id, value each column**/
<Col id="id">"Value"</Col>
</Row>
</Rows>
</Dataset>
</Root>
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/search.jsp/์ฝ๋ ๊ตฌํ/๊ฒฐ๊ณผ๊ฐ Client์๊ฒ ๋ณด๋ด๊ธฐ </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>๋ฅ์ฌํฌ๋ก search.jsp ์ ์ฒด ์ฝ๋ [/INST] [code](์ฝ๋ - search.jsp)
<!-- 1.Designating a Java library -->
<%@ page import="java.io.*" %>
<%@ page import="com.nexacro.java.xapi.data.*" %>
<%@ page import="com.nexacro.java.xapi.tx.*" %>
<!-- 2. Defining a MIME type -->
<%@ page contentType="text/xml; charset=UTF-8" %>
<%
/** 3. Creating a basic object of Nexacro **/
PlatformData pdata = new PlatformData();
/** 5.1 Processing ErrorCode and ErrorMsg **/
int nErrorCode = 0;
String strErrorMsg = "START";
try {
/** 4. Processing data : Loading data from the file: loading data from the file **/
/** 4.1 Loading data from the file **/
String sourceFilename = "./saveFile.bin";
InputStream source = new FileInputStream(sourceFilename);
PlatformRequest req = new PlatformRequest(source,
PlatformType.CONTENT_TYPE_BINARY);
req.receiveData();
source.close();
/** 4.2 Copying the loaded data to the dataset **/
pdata = req.getData();
/** 5.2 Setting ErrorCode and ErrorMsg for success **/
nErrorCode = 0;
strErrorMsg = "SUCC";
} catch (Throwable th) {
/** 5.3 Setting ErrorCode and ErrorMsg for failure **/
nErrorCode = -1;
strErrorMsg = th.getMessage();
}
/** 5.4 Saving ErrorCode and ErrorMsg to send them to the client **/
VariableList varList = pdata.getVariableList();
varList.add("ErrorCode", nErrorCode);
varList.add("ErrorMsg", strErrorMsg);
/** 6. Sending result data to the client **/
HttpPlatformResponse res = new HttpPlatformResponse(response,
PlatformType.CONTENT_TYPE_XML,"UTF-8");
res.setData(pdata);
res.sendData();
%>
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/search.jsp/์ ์ฒด ์ฝ๋ </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>๋ฅ์ฌํฌ๋ก save_list.jsp pseudo code [/INST] [code](// 1. Designating a Java library (including Nexacro X-API)
// 2. Defining a MIME type
// 3. Creating a basic object of Nexacro (PlatformData)
try {
// 4. Receiving a request from the client
// 5. Processing data
// 6. Processing ErrorCode and ErrorMsg (success message)
} catch (Error) {
// 6. Processing ErrorCode and ErrorMsg (failure message)
}
// 7. Sending result data to the client)
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/save_list.jsp/pseudo code </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>๋ฅ์ฌํฌ๋ก save_list.jsp ์์ฌ์ฝ๋ [/INST] [code](// 1. Designating a Java library (including Nexacro X-API)
// 2. Defining a MIME type
// 3. Creating a basic object of Nexacro (PlatformData)
try {
// 4. Receiving a request from the client
// 5. Processing data
// 6. Processing ErrorCode and ErrorMsg (success message)
} catch (Error) {
// 6. Processing ErrorCode and ErrorMsg (failure message)
}
// 7. Sending result data to the client)
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/save_list.jsp/pseudo code </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>๋ฅ์ฌํฌ๋ก save_list.jsp ํด๋ผ์ด์ธํธ ์์ฒญ๋ฐ๊ธฐ [/INST] ํด๋ผ์ด์ธํธ๊ฐ ๋งค๊ฐ๋ณ์๋ก ๋ณด๋ธ Dataset์ ๋ฐ์์ ์ฒ๋ฆฌํฉ๋๋ค.
[code]
(
/** 4. Receiving a request from the client **/
// create HttpPlatformRequest for receive data from client
HttpPlatformRequest req = new HttpPlatformRequest(request);
req.receiveData();
)
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/save_list.jsp/์ฝ๋ ๊ตฌํ/ํด๋ผ์ด์ธํธ ์์ฒญ๋ฐ๊ธฐ </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>๋ฅ์ฌํฌ๋ก save_list ๊ฒฐ๊ณผ๊ฐ Client์๊ฒ ๋ณด๋ด๊ธฐ [/INST] ์ด๊ธฐ๊ฐ์ด ์ ์์ ์ผ๋ก ํ์ผ์ ์ ์ฅ๋์๋์ง๋ฅผ ์ฌ์ฉ์์๊ฒ ์ ๋ฌํ๊ธฐ ์ํ์ฌ PlatformData ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํฉ๋๋ค. ์ด๋, ์์์ ์ ์ฅํ ErrorCode์ ErrorMsg๊ฐ ์ ๋ฌ๋ฉ๋๋ค.
VariableList๋ PlatformData์ ๋ฉค๋ฒ์ด๋ฏ๋ก ์ํ ๊ฒฐ๊ณผ๊ฐ์ PlatformData ๊ฐ์ฒด์ ๋ค์ด์์ต๋๋ค. ์ด์ PlatformData์ ๋ฐ์ดํฐ๋ฅผ ๋ฅ์ฌํฌ๋ก์์ ์ฒ๋ฆฌํ ์ ์๋ XML Format์ผ๋ก ์ถ์ถํ์ฌ ์ ์กํ๋ ๋ถ๋ถ์ ๊ตฌํํด ๋ณด๊ฒ ์ต๋๋ค. ๋ฐ์ดํฐ๋ฅผ ์ ์กํ๋ ๊ธฐ๋ฅ์ ์ฝ๊ฒ ๊ตฌํํ๊ธฐ ์ํด PlatformResponse ๊ฐ์ฒด๋ฅผ ๋ง๋ค๊ณ PlatformData ๊ฐ์ฒด์์ ๋ฐ์ดํฐ๋ฅผ ์ถ๋ ฅ์ํค๋ ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
[code](
/** 7. Sending result data to the client **/
HttpPlatformResponse res = new HttpPlatformResponse(response,
PlatformType.CONTENT_TYPE_XML,"UTF-8");
res.setData(senddata);
res.sendData();
)
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/save_list.jsp/์ฝ๋ ๊ตฌํ/๊ฒฐ๊ณผ๊ฐ Client์๊ฒ ๋ณด๋ด๊ธฐ </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>๋ฅ์ฌํฌ๋ก save_list.jsp ์ ์ฒด ์ฝ๋ [/INST] [code](์ฝ๋ - save_list.jsp)
<!-- 1. Designating a Java library -->
<%@ page import="java.io.*" %>
<%@ page import="com.nexacro.java.xapi.data.*" %>
<%@ page import="com.nexacro.java.xapi.tx.*" %>
<!-- 2. Defining a MIME type -->
<%@ page contentType="text/xml; charset=UTF-8" %>
<%
/** 3. Creating a basic object of Nexacro **/
PlatformData pdata = new PlatformData();
/** 6.1 Processing ErrorCode and ErrorMsg **/
int nErrorCode = 0;
String strErrorMsg = "START";
try {
/** 4. Receiving a request from the client **/
// create HttpPlatformRequest for receive data from client
HttpPlatformRequest req = new HttpPlatformRequest(request);
req.receiveData();
/** 5. Processing data: Loading data from the file **/
/** 5.1 Loading data from the http object **/
pdata = req.getData();
/** Obtaining a dataset from the received data **/
DataSet ds = pdata.getDataSet("customers");
/** Saving data as a file with init data **/
String targetFilename = "./saveFile.bin";
OutputStream target = new FileOutputStream(targetFilename);
PlatformResponse res = new PlatformResponse(target,
PlatformType.CONTENT_TYPE_BINARY);
res.setData(pdata);
res.sendData();
target.close();
/** 6.2 Setting ErrorCode and ErrorMsg for success **/
nErrorCode = 0;
strErrorMsg = "person list saved complete : row count("+ds.getRowCount()+")";
} catch (Throwable th) {
/** 6.3 Setting ErrorCode and ErrorMsg for failure **/
nErrorCode = -1;
strErrorMsg = th.getMessage();
System.out.println("ERROR:"+strErrorMsg);
}
/** 6.4 Saving ErrorCode and ErrorMsg to send them to the client **/
PlatformData senddata = new PlatformData();
VariableList varList = senddata.getVariableList();
varList.add("ErrorCode", nErrorCode);
varList.add("ErrorMsg", strErrorMsg);
/** 7. Sending result data to the client **/
HttpPlatformResponse res = new HttpPlatformResponse(response,
PlatformType.CONTENT_TYPE_XML,"UTF-8");
res.setData(senddata);
res.sendData();
%>
[source] ๋ฅ์ฌํฌ๋กN/์ด๋ณด์๋ฅผ ์ํ ์์ต์/ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/save_list.jsp/์ ์ฒด ์ฝ๋ </s> |
<s>[INST] <<SYS>> ๋ฅ์ฌํฌ๋กN<</SYS>>save_list.jsp ๋ฐ์ดํฐ ์ ์ฅ ์ด๋ฒคํธ [/INST] ํ๋ฉด ๋ง๋ค๊ธฐ (ํธ๋์ญ์
)์์ ๋ง๋ ํ๋ฉด์ ๋ฒํผ ์ปดํฌ๋ํธ๋ฅผ ์ถ๊ฐํ๊ณ ์๋์ ๊ฐ์ด onclick ์ด๋ฒคํธ๋ฅผ ์ถ๊ฐํฉ๋๋ค. ํ๋ฉด ๋ด ๋ฒํผ์ ํด๋ฆญํ๋ฉด save_list.jsp ์๋น์ค๊ฐ ํธ์ถ๋๋ฉด์ ํ๋ฉด์์ ์์ ํ ๋ฐ์ดํฐ์
์ ์๋ฒ๋ก ์ ์กํ๊ณ ๋ค์ ํ์ผ๋ก ์ ์ฅํฉ๋๋ค.
๋ฐ์ดํฐ๋ฅผ ์์ ํ ์ ์๋ ๊ธฐ๋ฅ์ ๊ฐ๋จํ๊ฒ ์ถ๊ฐํฉ๋๋ค. ํ๋ฉด ๋ด ๊ทธ๋ฆฌ๋๋ฅผ ๋๋ธํด๋ฆญํ๊ณ Grid Contents Editor๋ฅผ ์คํํ ๋ค์ Name ํญ๋ชฉ์ ์ ํํ ํ edittype ์์ฑ์ 'text'๋ก ์์ ํฉ๋๋ค.
[๊ทธ๋ฆผ](๋ฐ์ดํฐ ์ ์ฅ ์ด๋ฒคํธ-1)
๋ฐ์ดํฐ ์กฐํ ํ ํด๋น ํญ๋ชฉ์ ๋๋ธ ํด๋ฆญํ๋ฉด ๋ฐ์ดํฐ๋ฅผ ์์ ํ ์ ์์ต๋๋ค.
[๊ทธ๋ฆผ](๋ฐ์ดํฐ ์ ์ฅ ์ด๋ฒคํธ-2)
๋ฐ์ดํฐ ์์ ํ ์ ์ฅ(save) ๋ฒํผ์ ํด๋ฆญํด ๋ฐ์ดํฐ๋ฅผ ์๋ฒ๋ก ์ ์กํฉ๋๋ค.
ํ๋ฉด์ ์๋ก ๊ณ ์นจํ ๋ค์ ์กฐํ(Search) ๋ฒํผ์ ํด๋ฆญํ๋ฉด ์์ ํ ๋ฐ์ดํฐ๊ฐ ์กฐํ๋๋ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.
[code](
this.divCommand_btnSaveList_onclick = function(obj:nexacro.Button, e:nexacro.ClickEventInfo)
{
var id = "save_list";
var url = "SvcList::save_list.jsp";
var reqDs = "customers=dsCustomers";
var respDs = "";
var args = "";
var callback = "save_list_received";
this.transaction(id, url, reqDs, respDs, args, callback);
}
this.save_list_received = function(id, code, message)
{
if (code == 0) {
this.alert(message);
trace(message);
} else {
this.alert("Error["+code+"]:"+message);
trace("Error["+code+"]:"+message);
}
}
)
[source]ํ๋ฉด ๋ง๋ค๊ธฐ (X-API)/save_list.jsp/๋ฐ์ดํฐ ์ ์ฅ ์ด๋ฒคํธ </s> |