달력

03

« 2010/03 »

  •  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  •  
  •  
  •  


JSP에서 매번 System.out.println() 해서 tomcat의 catalina.log 등을 tail 등으로 감시하면서 개발을 하다.
ibatis + log4j 를 이용하여 쿼리를 디버깅 하던중...
binding (?) 된 값을을 볼수 없을까 하고 찾아 보던중...

log4sql 을 발견!!!

기존 jdbc driver를 변경만 해주면 멋진 log들이...

com.ibm.db2.jcc.DB2Driver -> core.log.jdbc.driver.DB2Driver


URL : http://log4sql.sourceforge.net/index_kr.html
개발하신분 블로그 : http://jquery.egloos.com/

제작하신 만든분 정말 감사합니다.!

참고 블로그 : http://westzero.net/16

Posted by 싸구려코드
AMChart 를 PNG 파일로 저장하는 코드...
org.jfree.chart.ChartUtilities의 writeBufferedImageAsPNG 이용...






amchart의 setting 파일에 다음 내용 추가...
Posted by 싸구려코드
2008/05/19 16:34

HashMap -> Collection -> Iterator Computer/IT/JAVA2008/05/19 16:34

  HashMap hashmap = new HashMap();

  Collection coll = hashmap.values();
  Iterator iter = coll.iterator();
  while (iter.hasNext()) {
    Object obj = iter.next();
  }

Posted by 싸구려코드
JAVA 와 C# 형타입 / 메서드 비교표

http://www.harding.edu/fmccown/java1_5_csharp_comparison.html
TAG c#, Compares, Java
Posted by 싸구려코드
2008/01/02 19:37

JAVA JSpinner Number 사용법 Computer/IT/JAVA2008/01/02 19:37


SpinnerModel model =
new SpinnerNumberModel(0, // 초기값
                0,        // 최소값
              100,        // 최대값
                1);       // 증가값
JSpinner spinner = new JSpinner(model);


'Computer/IT > JAVA' 카테고리의 다른 글

HashMap -> Collection -> Iterator  (0) 2008/05/19
제9회 자바 개발자 컨퍼런스 참관  (2) 2008/02/16
JAVA JSpinner Number 사용법  (0) 2008/01/02
ECLIPSE - eclipse.ini 실행옵션  (0) 2007/12/06
Servlet to Applet (Echo) Example  (0) 2007/11/23
Eclipse - JAD Pluggin  (0) 2007/11/19
TAG Java, JSpinner
Posted by 싸구려코드

<%
 String cmd = request.getParameter("cmd");
 
 if (cmd != null && cmd.equals("loginUserForm"))
 {
%>
  <jsp:include page="./user/loginUserForm.jsp" />
 
<%
 }  
%>



<%
 String cmd = request.getParameter("cmd");
 
 if (cmd == null) cmd = "main";
 
 if (cmd.equals("loginUserForm"))
 {
%>
  <jsp:include page="./user/loginUserForm.jsp" />
 
<%
 }  
%>

기본 nullpointer exception 처리.

조건검사를 한번 하던가... 디폴트 값 입력으로 일단 해결~
Posted by 싸구려코드
2006/10/01 18:39

[JSP] Java Beans(자바빈) Computer/IT/JSP2006/10/01 18:39

  1. public class BeanClassName implements java.io.Serializable {
  2.   /* 값을 저장하는 필드 */
  3.   private String value;
  4.   /* BeanClassName의 기본 생성자 */
  5.   public BeanClassName() {
  6.   }
  7.   /* 필드의 값을 get Method */
  8.   public String getValue() {
  9.     return value;
  10.   }
  11.   /* 필드의 값을 set Method */
  12.   public String setValue(String value) {
  13.     this.value = value;
  14.   }
  15. }

자바빈 기본형

'Computer/IT > JSP' 카테고리의 다른 글

[JSP] getParameter null pointer exception  (0) 2007/04/18
[Servlet] Redirection!  (0) 2007/04/18
[JSP] Java Beans(자바빈)  (0) 2006/10/01
[JSP] URLEncoder  (0) 2006/09/30
[JSP] page redirect  (0) 2006/09/30
[JSP] request method list  (0) 2006/09/30
Posted by 싸구려코드
 
  1. import java.io.File;

  2. public class FileInfo
  3. {
  4.   public static void main(String args[])
  5.   {
  6.     if(args.length!=1) {
  7.       System.out.println(" ex) : java FileInfo <파일이름>" );
  8.       System.exit(1);
  9.     }
  10.    
  11.     File infoFile = new File(args[0]);
  12.    
  13.     if(infoFile.exists()) {
  14.       System.out.println("파일이름 : " + infoFile.getName());
  15.       System.out.println("상대경로 : " + infoFile.getPath());
  16.       System.out.println("절대경로 : " + infoFile.getAbsolutePath());
  17.       System.out.println("쓰기가능 : " + infoFile.canWrite());
  18.       System.out.println("읽기가능 : " + infoFile.canRead());
  19.       System.out.println("숨은파일 : " + infoFile.isHidden());
  20.       System.out.println("파    일 : " + infoFile.isFile());
  21.       System.out.println("디렉토리 : " + infoFile.isDirectory());
  22.       System.out.println("파일크기 : " + infoFile.length() + "Byte");
  23.       System.out.println("최종수정 : " + infoFile.lastModified());
  24.     } else {
  25.       System.out.println("파일이 없습니다.");
  26.     }
  27.   }
  28. }

TAG file i/o, Java
Posted by 싸구려코드
2006/09/18 19:28

[JAVA] APPLET - ButtonEvent Computer/IT/JAVA2006/09/18 19:28

버튼을 생성하여 컨테이너 애플릿에 붙인뒤 이벤트 처리
  1. import java.awt.*;
  2. import java.applet.*;
  3. import java.awt.event.*;
  4. public class ButtonExam extends Applet implements ActionListener
  5. {
  6.   Label myLabel;
  7.   Button myButton1, myButton2, myButton3;
  8.   public void init()
  9.   {
  10.     myButton1 = new Button();
  11.     myButton1.setLabel("C언어");
  12.     myButton1.addActionListener(this);
  13.     add(myButton1);
  14.     myButton2 = new Button("C++언어");
  15.     myButton2.addActionListener(this);
  16.     add(myButton2);
  17.    
  18.     myButton3 = new Button("자바");
  19.     myButton3.addActionListener(this);
  20.     add(myButton3);
  21.    
  22.     myLabel = new Label();
  23.     myLabel.setText("버튼을 눌러주세요!");
  24.     myLabel.setAlignment(Label.CENTER);
  25.     myLabel.setBackground(Color.yellow);
  26.     add(myLabel);
  27.   }
  28.   public void actionPerformed(ActionEvent e)
  29.   {
  30.     if(e.getSource() == myButton1) {
  31.       myLabel.setText("선택 : C언어");
  32.     } else if(e.getSource()==myButton2) {
  33.       myLabel.setText("선택 : C++언어");
  34.     } else if(e.getSource()==myButton3) {
  35.       myLabel.setText("선택 : 자바");
  36.     }
  37.   }
  38. }

Posted by 싸구려코드
2006/09/18 19:18

[JAVA] APPLET - Label 사용예제 Computer/IT/JAVA2006/09/18 19:18

  레이블을 생성하여 Applet 컨테이너에 붙이는 Example
  1. import java.awt.*;
  2. import java.applet.*;
  3. public class LabelExam extends Applet
  4. {
  5.   Label myLabel1, myLabel2, myLabel3;
  6.   public void init()
  7.   {
  8.     myLabel1 = new Label();
  9.     myLabel1.setText("Label 테스트 프로그램");
  10.     myLabel1.setAlignment(Label.LEFT);
  11.     myLabel1.setBackground(Color.cyan);
  12.     add(myLabel1);
  13.   }
  14. }

TAG AWT, Java, Label
Posted by 싸구려코드
2006/09/14 14:10

[JAVA5] ActionEvent Example Computer/IT/JAVA2006/09/14 14:10

TextField 의 내용을 Console로 출력한다.

파일명 : ActionEvent1.java
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. public class ActionEvent1 extends Frame implements ActionListener {
  4.   TextField tf;
  5.   public ActionEvent1(String title) {
  6.     super(title);
  7.     tf=new TextField(20);
  8.    
  9.     // this는 Frame이면서, ActionListener 객체이다.
  10.     tf.addActionListener(this);
  11.    
  12.     //  텍스트 필드를 프레임(this)에 추가한다.
  13.     add(tf);   
  14.   }
  15.   public void actionPerformed(ActionEvent e) {
  16.     // 이벤트 소스가 TextField형 객체이면
  17.     if(e.getSource() instanceof TextField) {
  18.      
  19.       // 이벤트 소스를 가져온다.
  20.       TextField temp = (TextField)e.getSource();
  21.       // 화면에 temp의 문자열 출력
  22.       System.out.println(temp.getText());
  23.      
  24.       // temp의 내용을 지운다.  
  25.       temp.setText("");
  26.     }
  27.   }
  28.   public static void main(String args[]) {
  29.     ActionEvent1 me = new ActionEvent1("액션 이벤트 처리");
  30.     me.pack();
  31.     me.setVisible(true);
  32.   }
  33. }
 

'Computer/IT > JAVA' 카테고리의 다른 글

[JAVA] APPLET - Label 사용예제  (0) 2006/09/18
[JAVA5] 방향키를 이용해 button 움직이기  (0) 2006/09/14
[JAVA5] ActionEvent Example  (0) 2006/09/14
[JAVA] InetAddress  (0) 2006/09/14
콘솔입력받아 배열에 넣기  (0) 2006/04/16
JAVA class 정의  (0) 2006/04/12
Posted by 싸구려코드
2006/04/16 17:09

콘솔입력받아 배열에 넣기 Computer/IT/JAVA2006/04/16 17:09

[CODE type="java"]
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.StringTokenizer;
import java.io.IOException;

public class Grading
{

  private void mCTA()
  {

   BufferedReader br;
   StringTokenizer st=null;
   int i=0;
   int[] iArr= new int[10];

   System.out.print("Input ? ");

   br = new BufferedReader(new InputStreamReader(System.in));         

try
   {

     String str = br.readLine();
     System.out.println("\nInput-value = " + str);
     st = new StringTokenizer(str);
   }
  
   catch(IOException ioex)
   {
     ioex.printStackTrace();
   }

   while (st.hasMoreTokens())
   {
       iArr[i]= Integer.parseInt(st.nextToken());
       System.out.println("iArr[" + i + "]=" +iArr[i]);
       i++;
   }
  
  }

  public static void main(String[] args)
  {
   Grading cta=new Grading();
   cta.mCTA();
  }

}
[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

[JAVA5] ActionEvent Example  (0) 2006/09/14
[JAVA] InetAddress  (0) 2006/09/14
콘솔입력받아 배열에 넣기  (0) 2006/04/16
JAVA class 정의  (0) 2006/04/12
JAVA에서 Console 문자열 입력받기  (0) 2006/04/05
2차원 배열 생성, 값 배정  (0) 2006/04/05
Posted by 싸구려코드

[CODE type="java"]
class Middle2 {
public static void main(String arg[]) throws java.io.IOException{

 char choice;
 String s1="";
 String s2="";
 
 System.out.print("\n첫번째 문자열 입력 : ");
 while ((choice = (char)System.in.read()) != '\n')
 {
  s1 = s1 + choice;
 }
 System.out.print("\n첫번째 정수값 : ");
 System.out.println(s1);

 System.out.print("\n두번째 문자열 입력 : ");
 while ((choice = (char)System.in.read()) != '\n')
 {
  s2 = s2 + choice;
 }
 System.out.print("\n두번째 정수값 : ");
 System.out.println(s2);
 
 }
}

/* 위에서 제공하는 부분 코드를 가지고 중앙값을 구하는 프로그램을 완성하시오 */
[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

콘솔입력받아 배열에 넣기  (0) 2006/04/16
JAVA class 정의  (0) 2006/04/12
JAVA에서 Console 문자열 입력받기  (0) 2006/04/05
2차원 배열 생성, 값 배정  (0) 2006/04/05
swing 자바 Addtion  (0) 2006/04/04
연산자 instanceof  (0) 2006/04/01
Posted by 싸구려코드
2006/04/05 10:18

2차원 배열 생성, 값 배정 Computer/IT/JAVA2006/04/05 10:18

[CODE type="java"]
class TwoArray
{
public static void main(String args[])
{
 int two_array[][] = new int[4][5];
 int i,j,k=0;
 
 for(i=0;i<4;i++)
 {
  for(j=0;j<5;j++)
  {
   two_array[i][j] = k;
   k++;
  }
 }
 
 for(i=0;i<4;i++)
 {
  for(j=0;j<5;j++)
   System.out.print(two_array[i][j]+ " " );
  System.out.println();
 }
}
}
[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

JAVA class 정의  (0) 2006/04/12
JAVA에서 Console 문자열 입력받기  (0) 2006/04/05
2차원 배열 생성, 값 배정  (0) 2006/04/05
swing 자바 Addtion  (0) 2006/04/04
연산자 instanceof  (0) 2006/04/01
예약어 super  (0) 2006/04/01
Posted by 싸구려코드
2006/04/04 20:16

swing 자바 Addtion Computer/IT/JAVA2006/04/04 20:16

[CODE type="java"]
import javax.swing.JOptionPane;

public class Addition
{
public static void main(String args[])
{
String firstNumber, secondNumber;
int number1, number2, sum;

firstNumber = JOptionPane.showInputDialog("Inter First Integer");

secondNumber = JOptionPane.showInputDialog("Enter Second Integer");

number1 = Integer.parseInt(firstNumber);
number2 = Integer.parseInt(secondNumber);

sum = number1 + number2;

JOptionPane.showMessageDialog(null, "The sum is " + sum, "Result", JOptionPane.PLAIN_MESSAGE);

System.exit(0);
}
}
[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

JAVA에서 Console 문자열 입력받기  (0) 2006/04/05
2차원 배열 생성, 값 배정  (0) 2006/04/05
swing 자바 Addtion  (0) 2006/04/04
연산자 instanceof  (0) 2006/04/01
예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
TAG Java, JOption
Posted by 싸구려코드
2006/04/01 02:41

연산자 instanceof Computer/IT/JAVA2006/04/01 02:41

[CODE type="java"]
class A { }
class B extends A { }
class C extends B { }

public class instanceofTest
{
public static void main(String args[])
{
 B ob = new B();
 if (ob instanceof B) System.out.println("B의 객체");
 if (ob instanceof C) System.out.println("C의 객체");
 if (ob instanceof A) System.out.println("A의 객체");
 
 A oa = new A();
 if (oa instanceof A) System.out.println("A의 객체");
 if (oa instanceof B) System.out.println("B의 객체");
 if (oa instanceof C) System.out.println("C의 객체");
 
}

}

[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

2차원 배열 생성, 값 배정  (0) 2006/04/05
swing 자바 Addtion  (0) 2006/04/04
연산자 instanceof  (0) 2006/04/01
예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006/04/01
Posted by 싸구려코드
2006/04/01 02:28

예약어 super Computer/IT/JAVA2006/04/01 02:28

[CODE type="java"]
class C1
{
protected int a = 50;
private int b = 100;
static String x = "파이팅 자바";
void write()
{
System.out.println(x);
System.out.println(a);
System.out.println(b);
}
}


class C2 extends C1
{
String b = "어려운 자바";
String x = "쉬운 자바";
void write()
{
System.out.println(x);
System.out.println(a);
System.out.println(b);
super.write();
}
}


public class SuperTest2
{
public static void main(String args[])
{
C2 o = new C2();
o.write();
}
}

[/HTML][/CODE]

'Computer/IT > JAVA' 카테고리의 다른 글

swing 자바 Addtion  (0) 2006/04/04
연산자 instanceof  (0) 2006/04/01
예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006/04/01
-- ++ 연산자 테스트  (0) 2006/04/01
Posted by 싸구려코드
오버로딩과 오버라이딩은 서로 혼동하기 쉽지만 사실 그 차이는 명백하다. 오버로딩은 기존에 없는 새로운 메서드를 추가하는 것이고, 오버라이딩은 조상으로부터 상속받은 메서드의 내용을 변경하는 것이다.


오버로딩(Overloading) - 기존에 없는 새로운 메서드를 정의하는 것(new)
오버라이딩(Overriding) - 상속받은 메서드의 내용을 변경하는 것(change, modify)


아래의 코드를 보고 오버로딩과 오버라이딩을 구별할 수 있어야 한다.


class Parent {
    void parentMethod() {}
}

class Child extends Parent {
    void parentMethod() {} // 오버라이딩
    void parentMethod(int i) {} // 오버로딩

    void childMethod() {}
    void childMethod(int i) {} // 오버로딩
    void childMethod() {}       // 에러!!! 중복정의 되었음.(already defined in Child)
}

'Computer/IT > JAVA' 카테고리의 다른 글

예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006/04/01
-- ++ 연산자 테스트  (0) 2006/04/01
JAVA 기본 Data타입  (0) 2006/04/01
Jad - the fast JAva Decompiler  (0) 2006/03/17
Posted by 싸구려코드
2006/04/01 01:45

JAVA 기본 Data타입 Computer/IT/JAVA2006/04/01 01:45


[CODE type="c"]
public class DataTypeTest
{
public static void main(String args[])
{
System.out.println("1. 16진수값 : " + 0x11);
System.out.println("2. 8진수값 : " + 011);
System.out.println("3. 십진수값 : " + 111);
System.out.println("4. 2.0f / 3.0f = " + 2.0f / 3.0f);
System.out.println("5. 2.0 / 3.0 = " + 2.0 / 3.0);
System.out.println("6. 2/3 = " + 2/ 3);
System.out.println("7. 지수형 데이터 3.14159e-3 = " + 3.14159e-3);
System.out.println("8. 이진형 데이터 값 : " + true + (10 > 20));
System.out.println("9. 특수문자값 : \\ \"");
System.out.println("10. 유니코드값 : \u004a \u004f");
}
}

[/HTML][/CODE]


'Computer/IT > JAVA' 카테고리의 다른 글

예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006/04/01
-- ++ 연산자 테스트  (0) 2006/04/01
JAVA 기본 Data타입  (0) 2006/04/01
Jad - the fast JAva Decompiler  (0) 2006/03/17
TAG datatype, Java
Posted by 싸구려코드
2006/03/17 09:20

Jad - the fast JAva Decompiler Computer/IT/JAVA2006/03/17 09:20



자바 class -> java로 다시 디컴파일러 하는 툴...
http://www.kpdus.com/jad.html

'Computer/IT > JAVA' 카테고리의 다른 글

예약어 super  (0) 2006/04/01
멤버 변수의 상속  (0) 2006/04/01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006/04/01
-- ++ 연산자 테스트  (0) 2006/04/01
JAVA 기본 Data타입  (0) 2006/04/01
Jad - the fast JAva Decompiler  (0) 2006/03/17
Posted by 싸구려코드