String noHTMLString = htmlString.replaceAll("\\<.*?\\>", "");


String regex1 = "\\<.*?\\>";
String regex2 = "<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>";
String html = "가<aaa>나</bbb>다<ccc/>라<한글>마<ddd >바< eee >사< img src=\"한글\" >아\n";
System.out.println(html.replaceAll(regex1, ""));
System.out.println(html.replaceAll(regex2, ""));

==== 실행결과 ======
가나다라마바사아
가나다라<한글>마바< eee >사< img src="한글" >아


참고 사이트
http://snippets.dzone.com/posts/show/4018 
http://javacan.madvirus.net/main/content/read.tle?contentId=122 (최범균님)

http://forum.java.sun.com/thread.jspa?threadID=683818&messageID=3983002
http://www.rgagnon.com/javadetails/java-0424.html
http://java-source.net/open-source/html-parsers
Posted by 에코지오
,
* agimatec-validation  http://code.google.com/p/agimatec-validation/

JSR 303: bean-validation 스펙을 구현한 라이브러리. 아래는 agimatec-validation 사용예제.

javax.validation.Validator customerValidator = new ClassValidator(Customer.class);
Set<InvalidConstraint<Customer>> violations = customerValidator.validate(customer);
public class Customer{
    @NotEmpty(groups = "last")
    private String firstName;
    @NotEmpty(groups = "first")
    private String lastName;
    @Length(max = 30, groups = "last")
    private String company;
    @Valid
    private List<Address> addresses;
   
    ....
}

그 밖에 다음 글도 참고할 것.

- Bean Validation Sneak Peek http://in.relation.to/Bloggers/BeanValidationSneakPeekPartI
- 기선님 Spring MVC Validation 정리(스프링 validator와 valang)
- 기선님 Really easy field validation 사용하기(이건 css를 통해 브라우저단에서 입력값을 검증하는 것)
- 스트러츠2에서 어노테이션방식 입력값검증 http://struts.apache.org/2.x/docs/validation-annotation.html
- 하이버네이트 Validator http://www.hibernate.org/hib_docs/validator/reference/en/html/validator-defineconstraints.html
- springmodules https://springmodules.dev.java.net/docs/reference/0.8/html/validation.html#d0e9699
Posted by 에코지오
,
- this.getClass().getResource();

- this.getClassLoader().getResource();

- Thread.currentThread().getContextClassLoader().getResource();

- MyClass.class.getResource();

위 4가지의 차이점은 아래 링크 참조.

http://www.javaworld.com/javaworld/javaqa/2002-11/02-qa-1122-resources.html
http://www.jroller.com/coreteam/entry/loading_configuration_files_under_web


그럼 스프링 사용환경에서는 보통 어떻게 로딩하지?

일단 링크 걸어두고 읽어봐야겠다.

http://static.springframework.org/spring/docs/2.5.x/reference/resources.html
http://www.carbonfive.com/community/archives/2007/05/using_classpath.html


Posted by 에코지오
,