12.07.2015 Views

4.3.1.Action의 역할 - Anyframe

4.3.1.Action의 역할 - Anyframe

4.3.1.Action의 역할 - Anyframe

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8.Exception Handling[Action클래스의 execute() 메소드에서 Exception이 전달되었을 때 실행하는 ExceptionHandler를 설정할 수 있다. struts-config.xml에 개별 Action에 대한 ExceptionHandler를 설정할 수도 있고(actionlevel), 을 이용해 application의 모든 Action에서 발생하는 Exception에 대한ExceptionHandler를 설정(global level)할 수도 있다. 양쪽 모두에 ExceptionHandler가 정의되었을 때action level에 선언된 것이 더 우선순위가 높다.8.1.Global Level Exception Handling8.1.1.Global Level Exception Handling의 특징• 에러나 Exception 처리를 정의하는 선언적인 방법• 모든 action에서 사용할 수 있는 global level Exception 처리를 정의• 하위로 여러 개의 을 가질 수 있음다음은 의 attribute들이다.NameDescriptionbundle Exception의 handler 클래스가 사용하는 message resources bundle에 대한 servlet context attribute의 name 값이다. 디폴트 값 :org.apache.struts.Globals.MESSAGES_KEY의 값className Exception들의 configuration 정보를 담고 있을 객체이다. 반드시org.apache.struts.config.ExceptionConfig 또는 이를 상속 받은 클래스여야 한다.디폴트 값 : org.apache.struts.config.ExceptionConfighandler 이 exception이 발생할 때, 이 exception을 처리하는 클래스를 나타낸다. 즉,handler 클래스는, 어떤 exception이 발생하면, 적절한 error message('key'attribute)와 함께 적절한 페이지('path' attribute)로 forward 해주는 클래스이다. 반드시 org.apache.struts.action.ExceptionHandler 또는 이를 상속 받은 클래스여야한다. 디폴트 값 : org.apache.struts.action.ExceptionHandlerkeypathscopetype8.1.2.Samples이 exception이 발생할 때, message resource bundle에서 찾아낼 error message의 key 값이다. [required]이 exception이 발생할 때, forward할 resource(*.do, *.jsp 등)의 상대(modulerelative)경로를나타낸다.ActionError 객체에 접근할 context의 scope를 나타낸다. request 또는 session. 디폴트 값 : requestException Handling을 수행할 exception의 type을 나타낸다. [required]다음은 struts-config.xml 파일에서 global-exceptions 설정에 대한 예제이다.42

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!