tartgetString.replaceAll("\\<.*?\\>", "")
그냥 정규식으로 처리해버렸다. 100% 신뢰 할수 없는 방법이지만....
2008년 10월 20일 월요일
JSP: html tag strip
2008년 10월 12일 일요일
HTML: scroll css
<style type="text/css">
div.contxt {
scrollbar-3dlight-color:white;
scrollbar-arrow-color:gray;
scrollbar-base-color:black;
scrollbar-darkshadow-color:black;
scrollbar-face-color:black;
scrollbar-highlight-color:white;
scrollbar-shadow-color:white;
}
</style>
2008년 10월 1일 수요일
JAVA: NAVER OPEN MAP & HTTP CLIENT
적당히 아래와 같이 쓸 수도 있겠다.
JSP 페이지도 적당히 만들어서 적당히 IMPORT하여 쓰는 방법이 오히려 더 편할 것 같기도 하지만..
뭐.. 적당히 적당히...
<%
String adress = request.getParameter("adress");
adress = URLDecoder.decode(adress, "utf-8");
HttpClient client = new HttpClient();
PostMethod httppost = new PostMethod("http://maps.naver.com/api/geocode.php");
//한글 처리를 위한 헤더 셋팅
httppost.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded; charset=euc_kr");
DefaultMethodRetryHandler retryhandler = new DefaultMethodRetryHandler();
retryhandler.setRequestSentRetryEnabled(false);
// retry 시도 실패 했을때..
retryhandler.setRetryCount(3);
httppost.setMethodRetryHandler(retryhandler);
httppost.addParameter("key", "naver api key");
httppost.addParameter("query",adress);
try {
client.executeMethod(httppost);
if (httppost.getStatusCode() == HttpStatus.SC_OK) {
String bodyString = httppost.getResponseBodyAsString();
//System.out.println(httppost.getResponseBodyAsString());
XStream xStream = new XStream(new DomDriver());
xStream.alias("geocode",GeoCode.class);
xStream.alias("item",Item.class);
xStream.addImplicitCollection(GeoCode.class, "items");
GeoCode geoCode = (GeoCode)xStream.fromXML(bodyString);
String result = ((Item)geoCode.getItems().get(0)).getPoint().toJson();
out.print(result);
System.out.print("result : " + result);
} else {
System.out.println("Unexpected failure: "
+ httppost.getStatusLine().toString());
}
} finally {
httppost.releaseConnection();
}
%>
2008년 9월 26일 금요일
JAVA: USE ORALCE CLOB
아래 4월달에 쓴 글도 있지만 삽질의 흔적으로 삼고자 글을 새로 쓴다.
/**
* oracle의 CLOB을 이용하여 java의 Clob을 생성한다.
*
* @param clobValue
* @param conn
* @return
* @throws Exception
*/
public static Clob getClob(String clobValue, Connection conn) throws Exception{
Clob newClob= null;
if(clobValue!=null) {
try{
if (conn.getClass() == UserConnectionAdapter.class) { //env: resin pool connection
newClob = oracle.sql.CLOB.createTemporary(
((UserConnectionAdapter)conn).getConnection() ,
true, oracle.sql.CLOB.DURATION_SESSION);
} else if (conn.getClass() == OracleConnection.class) { //env: oracle connection
newClob = oracle.sql.CLOB.createTemporary(
conn,
true, oracle.sql.CLOB.DURATION_SESSION);
} else if (conn.getClass() == Connection4Oracle.class) { //env: jennifer connection
conn = ((Connection4Oracle)conn).getNativeConnection();
newClob = oracle.sql.CLOB.createTemporary(
((UserConnectionAdapter)conn).getConnection(),
true, oracle.sql.CLOB.DURATION_SESSION);
} else { //env: else connection
newClob = oracle.sql.CLOB.createTemporary(
conn,
true, oracle.sql.CLOB.DURATION_SESSION);
}
if(newClob!=null) {
((oracle.sql.CLOB)newClob).putString(1, clobValue);
}
} catch (Exception e){
e.printStackTrace();
}
}
return newClob;
}
위의 메소드를 이용해서
psmt.setClob(psmtIndex++, DaoHelper.getClob( info.getEtcInfo(), conn ));
dao 단의 코딩이 좀더 깔끔하게 되었다.
좀더 정리 할 필요가 있지만 그건 조금 나중이 될 듯 하다.
2008년 9월 24일 수요일
JAVASCRIPT: RADIO 값 가져 오기 (WITH PROTOTYPE)
http://xavisys.com/2007/03/using-prototype-javascript-to-get-the-value-of-a-radio-group/
prototype을 써도 radio 값을 가져올때는 좀 껄끄럽다.(버젼업에서는 해결되길 바라며..)
위의 링크를 참조하자.
function $RF(el, radioGroup) {
if($(el).type && $(el).type.toLowerCase() == 'radio') {
var radioGroup = $(el).name;
var el = $(el).form;
} else if ($(el).tagName.toLowerCase() != 'form') {
return false;
}
var checked = $(el).getInputs('radio', radioGroup).find(
function(re) {return re.checked;}
);
return (checked) ? $F(checked) : null;
}
이 function으로 간단하게 가져 올 수 있다.
var value = $RF('radio_btn_id');
var value = $RF('form_id', 'radio_grp_name');
이정도는 직접 짜버릇 해야 되는데.. 이넘의 ctrl+C + ctrl+V의 습관은 좀처럼 고쳐질 줄을 모른다.
피드 구독하기:
글 (Atom)