본문 바로가기

Struts6

Struts2 + Tiles2 + Freemarker 설정 버전 struts-2.2.3.1 tiles-2.2.2 freemarker-2.3.18 최소 필요 라이브러리 commons-beanutils-1.7.0.jar commons-digester-2.0.jar commons-fileupload-1.2.2.jar commons-io-2.0.1.jar commons-lang-2.5.jar commons-logging-1.1.1.jar freemarker.jar javassist-3.11.0.GA.jar log4j-1.2.16.jar ognl-3.0.1.jar slf4j-api-1.6.1.jar slf4j-log4j12-1.6.1.jar struts2-core-2.2.3.1.jar struts2-tiles-plugin-2.2.3.1.jar tiles-api-2.2.2.. 2011. 9. 14.
Struts2 + Spring2.5 WAS 재기동 없이 수정된 파일 적용하기 웹서버 재기동 없이 클래스, xml, properties 파일 추가 가능 struts.propertiesstruts.class.reloading.watchList = /WEB-INF/classesstruts.devMode = true web.xmlcontextClassorg.apache.struts2.spring.ClassReloadingXMLWebApplicationContext /WEB-INF/libcommons-jci-fam-1.0.jar 파일 추가 끝. 2011. 9. 11.
Struts2 + Freemarker 상수 TIP (이 중 몇가지는 최신버전인 2.3.18 에서만 되는 것도 있음)${.version} : 프리마커 버전 ${.template_name} : 템플릿 파일 이름 ${.locale} : 언어_국가 ${.lang} : 언어 ${.now} : 현재 날짜 + 시간 ${.now?date} : 현재 날짜 ${.now?time} : 현재 시간 ${base} : context path -> sturts2에서는 base 속성 값이 자동추가 되어 존재하지만 spring은 없음 끝. 2011. 9. 11.
Struts2 + Freemarker 성능 튜닝 freemarker.properties프리마커에서 ftl 파일 리로딩이 기본적으로 0.5초로 설정되어 있음.ftl 파일을 직접적으로 수정할 일이 있을 경우 적당한 값을 지정하고 없을 경우엔 큰 값을 두어 성능 향상. - 기본 : template_update_delay=500 (명시 안했을 때) - 개발 : template_update_delay=0 - 서비스 : template_update_delay=60000 (ftl 수정한 파일이 바로 적용될 필요가 없으면 큰 값으로) struts.propertiesstruts.freemarker.templatesCache=trueWEB_APP/templates 생성하면 이 폴더에 build 된 ftl 파일들이 복사되어짐. 수정된 날짜를 비교하여 사용하는 걸로 보임... 2011. 9. 11.
Struts2 FreemarkerManager를 이용한 공통 변수 Struts2 에서 freemarker 를 쓸 경우Java 클래스변수처럼 공통 변수를 사용할 때가 있다.보통 Spring 에 xxx.xml 에 공통 변수를 정의하고 클래스에서 DI 로 호출하여Java 와 Freemarker 에서 사용한다. 예)1. xxx.xml 2. Consts.javaprivate Map consts; public void setConsts(Map consts) { this.consts = consts;} public Map getConsts() { return this.consts;} public String getConst(String key) { return this.consts.get(key);} 3. consts.ftl${consts.getConst('A')} 하지만 이 방식.. 2011. 8. 26.
There is no Action mapped for namespace / and action name . - [unknown location] Struts 2.2.3 사용 web.xml 작성 struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* struts.properties 파일 변경없이 톰캣을 실행하면 예외가 발생한다. There is no Action mapped for namespace / and action name . - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.ja.. 2011. 7. 22.