KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > form > ConfirmComponentTag


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.form;
14
15 import java.net.MalformedURLException JavaDoc;
16 import java.net.URL JavaDoc;
17
18 import javax.servlet.jsp.JspException JavaDoc;
19
20 import org.apache.log4j.Logger;
21 import org.w3c.dom.Document JavaDoc;
22
23 import com.tonbeller.wcf.component.Component;
24 import com.tonbeller.wcf.component.ComponentTag;
25 import com.tonbeller.wcf.controller.RequestContext;
26 import com.tonbeller.wcf.utils.ResourceLocator;
27 import com.tonbeller.wcf.utils.XmlUtils;
28
29 /**
30  * creates a ConfirmComponent
31  *
32  * @author av
33  */

34 public class ConfirmComponentTag extends ComponentTag {
35   private static final Logger logger = Logger.getLogger(ConfirmComponentTag.class);
36
37   private String JavaDoc xmlUri;
38   
39   public ConfirmComponentTag() {
40     super.id = ConfirmComponent.SESSIONKEY;
41   }
42   public void release() {
43     super.release();
44     super.id = ConfirmComponent.SESSIONKEY;
45   }
46
47   /**
48    * loads a form from an xml file and registeres it with the controller.
49    */

50   public Component createComponent(RequestContext context) throws JspException JavaDoc {
51     try {
52       String JavaDoc xmlUri1 = (xmlUri != null) ? xmlUri : "/WEB-INF/wcf/confirm.xml";
53       URL JavaDoc url = ResourceLocator.getResource(context.getServletContext(), context.getLocale(),
54           xmlUri1);
55       Document JavaDoc doc = XmlUtils.parse(url);
56       
57       //In replaceI18n(...) wird geprüft, ob "bundle"-Attribut vorhanden
58
FormDocument.replaceI18n(context, doc, null);
59       
60       // create the component
61
return new ConfirmComponent(id, null, doc);
62     } catch (MalformedURLException JavaDoc e) {
63       logger.error(null, e);
64       throw new JspException JavaDoc(e);
65     }
66   }
67
68   /**
69    * Sets the xmlUri.
70    * @param xmlUri The xmlUri to set
71    */

72   public void setXmlUri(String JavaDoc xmlUri) {
73     this.xmlUri = xmlUri;
74   }
75
76 }
77
Popular Tags