File file = new File(path + fileName);
file.toURL().openConnection().getContentType(); // 1
URLConnection.guessContentTypeFromName(orgFile.getName()); // 2
URLConnection.guessContentTypeFromStream(new BufferedInputStream(new FileInputStream(orgFile))); // 3
new MimetypesFileTypeMap().getContentType(orgFile); // 4
Files.probeContentType(Paths.get(orgFile.toURI())); // 5

위의 방법으로 엑셀 2007 형식의 파일을 분석했을때 오피스가 설치된 pc와 설치되지 않은 pc에서 각각 다른 반응을 보였다.


1. 설치된 pc

1 >>>>>>content/unknown

2 >>>>>>null

3 >>>>>>null

4 >>>>>>application/octet-stream

5 >>>>>>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet


2. 설치되지 않은 pc

1 >>>>>>content/unknown

2 >>>>>>null

3 >>>>>>null

4 >>>>>>application/octet-stream

5 >>>>>>null


5번이 가장 정확한 내용을 알려주지만 경우에 따라서 null이 나올 수도 있으므로 4번이 가장 무난한 선택일수도 있겠다.


'Java' 카테고리의 다른 글

mybatis의 insert후 sequence 가져오기  (0) 2014.08.21
MS-SQL JDBC 추가하기.  (0) 2014.07.28
JSTL에서 substring, length  (0) 2013.09.26
EL 함수 추가하기  (0) 2013.09.10
Apache POI 추가  (0) 2013.08.22
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>


.
.
.


<c:set var="text" value="${testText}"/>
<c:set var="len" value="${fn:length(text)}"/>

${fn:substring(text,0,len-2)}

 

'Java' 카테고리의 다른 글

MS-SQL JDBC 추가하기.  (0) 2014.07.28
MIME 타입 알아내는 방법  (0) 2013.10.02
EL 함수 추가하기  (0) 2013.09.10
Apache POI 추가  (0) 2013.08.22
Spring 실행 쿼리문 콘솔 출력 - log4jdbc-remix (feat. 메이븐)  (0) 2013.08.08
ALTER USER 아이디 IDENTIFIED BY 비밀번호

'DB > Oracle' 카테고리의 다른 글

' 홑따옴표 처리  (0) 2013.09.04
오라클 명세서 쿼리  (0) 2013.03.27
update select문  (0) 2013.03.21
날짜변환  (0) 2013.02.01

오류내용

net.sf.json.JSONObject 를 사용하는데, 콘솔에서는 한글이 깨지지 않지만 한글이 ? 로 나오는 상황이 발생



해결

json 출력 상단에 아래의 문장을 추가했다.

response.setCharacterEncoding("UTF-8");





그리드 reload


$("#tblist1").trigger("reloadGrid"); // 보통
$("#tblist1")[0].triggerToolbar(); // filterToolbar를 사용한 경우


그리드 url 바꿀때

$("#tblist1").setGridParam({url:"xml/data_xml.jsp"});


그리드 clear

$("#tblist1").clearGridData(true);


멀티셀렉트 되는 그리드에서 체크박스 전체 해제


$("#tblist1").jqGrid('resetSelection');


멀티셀렉트 되는 그리드에서 특정값 체크박스 선택되게

$('#tblist1').jqGrid('setSelection', 'tblist1 row id값').prop('checkbox', true);




+ Recent posts