KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > facelets > tag > jstl > core > CatchHandler


1 /**
2  * Licensed under the Common Development and Distribution License,
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  * http://www.sun.com/cddl/
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
11  * implied. See the License for the specific language governing
12  * permissions and limitations under the License.
13  */

14
15 package com.sun.facelets.tag.jstl.core;
16
17 import java.io.IOException JavaDoc;
18
19 import javax.el.ELException;
20 import javax.faces.FacesException;
21 import javax.faces.component.UIComponent;
22
23 import com.sun.facelets.FaceletContext;
24 import com.sun.facelets.FaceletException;
25 import com.sun.facelets.tag.TagAttribute;
26 import com.sun.facelets.tag.TagConfig;
27 import com.sun.facelets.tag.TagHandler;
28
29 /**
30  * @author Jacob Hookom
31  * @version $Id: CatchHandler.java,v 1.4 2005/08/24 04:38:51 jhook Exp $
32  */

33 public final class CatchHandler extends TagHandler {
34
35     private final TagAttribute var;
36
37     /**
38      * @param config
39      */

40     public CatchHandler(TagConfig config) {
41         super(config);
42         this.var = this.getAttribute("var");
43     }
44
45     public void apply(FaceletContext ctx, UIComponent parent)
46             throws IOException JavaDoc, FacesException, FaceletException, ELException {
47         try {
48             this.nextHandler.apply(ctx, parent);
49         } catch (Exception JavaDoc e) {
50             if (this.var != null) {
51                 ctx.setAttribute(this.var.getValue(ctx), e);
52             }
53         }
54     }
55
56 }
57
Popular Tags