2010-08-03 3 views
2

Struts2 fileUpload 인터셉터를 사용하여 파일을 업로드하고 있습니다. maxSize, allowed contentTypes ... props 등을 구성했습니다. 그러나 사용자가 maxSize를 위반하면 ... 매우 긴 문자열 인 Struts2 디스플레이 오류 메시지 ...struts.messages.error.file.too.large 속성을 재정의하는 방법

메시지 문자열을 변경하고 싶습니다. 즉 어떻게 할 수 있습니까? struts.messages.error.file.too.large를 재정의하십시오. 어떤 생각입니까?

감사합니다.

답변

3

당신은 세계적으로 클래스 나에 대한 기존 메시지 리소스 .properties 파일 (들)의 사용자 지정 오류 메시지를 정의 할 수 있습니다 :

struts.messages.error.uploading=Upload error. 
struts.messages.error.file.too.large=Uploaded file was too large. 
struts.messages.error.content.type.not.allowed=File type is not allowed. 
struts.messages.error.file.extension.not.allowed=File extension is not allowed. 

현재 텍스트를 저장하는 .properties의 파일을 사용하지 않는 경우, 문서에는 Message Resource Files을 사용하고 구성하는 좋은 섹션이 있습니다.

관련 문제