JAVA OPEN API2013. 10. 23. 13:52

web.xml

<context-param>
<param-name>webAppRootKey</param-name>
<param-value>webapp.root</param-value>
</context-param>



log4j.xml

    <appender name="dailyout" class="org.apache.log4j.DailyRollingFileAppender">  

        <!-- 이것은 날짜별로  로그를 남김. 파일명.확장자.DatePattern으로 정의 함-->  

        <param name="file" value="${webapp.root}/WEB-INF/logs/spring.log"/>  

        <param name="Append" value="true"/>  

        <param name="DatePattern" value="'.'yyMMdd"/>  

        <layout class="org.apache.log4j.PatternLayout">  

            <param name="ConversionPattern" value="%t> [%d{yyyy-MM-dd HH:mm:ss}] [%c{1}] [%L] [%p] %m %n"/>  

        </layout>  

    </appender>  

Posted by 선한열심
JAVA OPEN API2013. 9. 26. 10:33

 

<dynamic prepend="And A.CONTENT_ID IN">
    <iterate open="(" close=")" conjunction=",">
               #[]#
     </iterate>
</dynamic>

'JAVA OPEN API' 카테고리의 다른 글

[ehcache]-[펌] 캐시 Ehcache  (0) 2013.10.23
[log4j] 로그파일위치변경  (0) 2013.10.23
[JSON] 샘플  (0) 2013.08.22
[ibatis] if else 처리, null 처리  (0) 2013.08.22
[ibatis] 여러개 resultMap 과 groupBy 사용 예제  (0) 2013.08.22
Posted by 선한열심
JAVA OPEN API2013. 8. 22. 13:35

http://jeonguk.tistory.com/entry/java에서-손쉽게-JSON을-사용한다-JSONsimple-example-–-Read-and-write-JSON

 

http://beizix.egloos.com/1633352

 

http://lonelycat.tistory.com/374 : 자세히 나옴

 

데이터 표현 방식 : [] 배열 ,  {'a':'b'}

var cafe = {"cafelist" : [
{"name" : "aaaaaa", "clubid" : "11111111"},
{"name" : "bbbbbbb", "clubid" : "2222222"},
{"name" : "CCC", "clubid" : 123213213}
]
};

Posted by 선한열심
JAVA OPEN API2013. 8. 22. 11:05

if else 처리

<isEqual property="AAA" compareValue="T">  </isEqual>

<isNotEqual property="AAA" compareValue="T">  </isNotEqual>

 

null 처리

<isNotEmpty property="AAA">   </isNotEmpty>

Posted by 선한열심
JAVA OPEN API2013. 8. 22. 10:39

참고 AAAVO 안에
aaa1 ~ 4
<List> aaaList


 <resultMap id="CCCList" class="CCCVO">
  <result property="ccc1"   column="ccc1" />
  <result property="ccc2"   column="ccc2" />
 </resultMap>
 <resultMap id="BBBList" class="BBBVO" groupBy="bbb1">
  <result property="bbb1"      column="bbb1"/>
  <result property="bbb2"     column="bbb2"/>
  <result property="cccList"  resultMap="aNew.CCCList"/>
 </resultMap>
 <resultMap id="AAA" class="AAAVO" groupBy="aaa1">
        <result property="aaa1"        column="aaa1"/>  
        <result property="aaa2"    column="aaa2" />
  <result property="aaaList"  resultMap="aNew.BBBList"/>
    </resultMap>
   
 <select id="aNew.getList" resultMap="AAA">
 </select>
 
 
필드 aaa1, aaa2, bbb1, bbb2, ccc1, ccc2
       a1   a2        b11   b21      c11   c21
       a1   a2        b11   b21      c12   c22
       a1   a2        b11   b21      c13   c23
       a1   a2        b12   b22      c14   c24
       a1   a2        b12   b22      c15   c25
       a1   a2        b12   b22      c16   c26
 

Posted by 선한열심
JAVA OPEN API2013. 7. 15. 15:45

 

HashMap<String, String> map1 = new HashMap<String, String>();
map1 .put("test1", "111");

map1 .put("test2", "222");

List<TVO> list = TDAO.getList(map1 );

=>

    public List<TVO > getList(HashMap<String, String> map1 ) {
        return getSqlMapClientTemplate().queryForList("getList",  map1 );
    }

=> XML


    <select id="getList" resultMap="??Result" parameterClass="java.util.Map">

  <isNotEmpty property="test1">

</isNotEmpty>

<isNotEmpty property="test2">

</isNotEmpty>

 </select>

 

Posted by 선한열심
JAVA OPEN API2013. 7. 2. 13:22

1. poi 버전 문제  ( 3.2 이상으로 하면 된다고함 )

2. xls 파일 자체 오류로 판단됨 ( 다른 엑셀파일로 테스트 해보세요 )

 

'JAVA OPEN API' 카테고리의 다른 글

[ibatis] 여러개 resultMap 과 groupBy 사용 예제  (0) 2013.08.22
[ibatis] map 으로 파라미터 받기  (0) 2013.07.15
[POI] Excel 읽고 쓰기  (0) 2013.07.02
sitemesh.xml 설정  (0) 2013.06.19
[ibatis] in 처리  (0) 2013.06.17
Posted by 선한열심
JAVA OPEN API2013. 7. 2. 13:19

http://poi.apache.org/spreadsheet/how-to.html#sxssf

Reading or modifying an existing file 샘플

http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/HSSFReadWrite.java

 

읽고쓰기

FileOutputStream fos = null;
  try
  {
   HSSFWorkbook workbookTest;
   HSSFSheet activeSheetTest;
   
   FileInputStream fis = new FileInputStream( "write.xls");
   workbookTest = new HSSFWorkbook(fis);
   activeSheetTest = workbookTest.getSheetAt(0);

   // 저장할 위치를 확인한다.
   File file = new File(targetPath);
   

   HSSFRow row = activeSheetTest.getRow(0);
   
   // 처리결과 쓰기
   HSSFCell cell = row.getCell(1);
   //cell.getStringCellValue();
   //System.out.println(" cell.getStringCellValue()= " + cell.getStringCellValue() );
   cell.setCellType(HSSFCell.CELL_TYPE_STRING);
   cell.setCellValue(new HSSFRichTextString("111"));
   
   // 오류내용 쓰기
   cell = row.getCell(2);
   cell.setCellType(HSSFCell.CELL_TYPE_STRING);
   cell.setCellValue(new HSSFRichTextString("222"));
 
   
   // 저장경로에 엑셀파일을 저장한다.
   fos = new FileOutputStream(targetPath);
   workbookTest.write(fos);
  }

  catch ( Exception e )
  {
    System.out.println(e);
        }

  finally
  {
   if ( fos != null ) {
    try { 
     fos.close();
    }
    catch(Exception e) {
     
    }
            }
  }

poi-3.9-20121203.jar

 

ExcelTest.java

 

read.xls

Posted by 선한열심
JAVA OPEN API2013. 6. 19. 18:20

네이버  : "sitemesh(사이트메쉬) 해보기" 검색하면 나옴

http://cafe.naver.com/buldon/2005

 

1. jar파일 다운로드 ( http://opensymphony.com/  프로젝트 임 )

  http://www.sitemesh.org/ - > download  ( sitemesh-버전.jar , 최신 2.4.2 )

 

2. web.xml 설정 추가

 <!-- Sitemesh Configration -->
 <filter>
  <filter-name>sitemesh</filter-name>
  <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
 </filter>
 <filter-mapping>
  <filter-name>sitemesh</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>

3. /WEB-INF/decorators.xml 설정

 <?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/decorators">
    <decorator name="basic-theme" page="basic-theme.jsp">
        <pattern>/data/*</pattern>
    </decorator>
</decorators>

4. basic-theme.jsp 파일

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Café Mirabeau</title>
</head>
<body>
    <h1>Header</h1>
    <p><b>Navigation</b></p>   
    <hr />
    <decorator:body />    
    <hr />
    <h1>Footer</h1>
</body>
</html>

 

5. /data/hour.jsp      ( 화면에 보일때는 basic-theme.jsp 안에 hour.jsp파일의 body가 자동으로 들어가서 보인다 )

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Hours</title>
</head>
<body>
    <h1>Weekdays</h1>
    <p>5:00pm - 10:00pm</p>
    <p>Weekends</p>
    <p>5:00pm - 10:00pm</p>
</body>
</html>

 

sitemesh에서 제공하는 파일   cafe.war

Posted by 선한열심
JAVA OPEN API2013. 6. 17. 16:55

1. in ('a','b') 등 처리 방법
       <isNotEmpty  property="deviceIDList">
           <iterate prepend="AND F1.DVCE_MODEL_ID IN " property="deviceIDList" open="(" close=")" conjunction=",">
               #deviceIDList[]#
           </iterate>
          </isNotEmpty>

 

2. <> 처리   => <![CDATA[<>]]> 

자세한 설명 참고 : http://lonelycat.tistory.com/289

Posted by 선한열심