1 13 package com.tonbeller.wcf.form; 14 15 import java.net.MalformedURLException ; 16 import java.net.URL ; 17 18 import javax.servlet.jsp.JspException ; 19 20 import org.apache.log4j.Logger; 21 import org.w3c.dom.Document ; 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 34 public class ConfirmComponentTag extends ComponentTag { 35 private static final Logger logger = Logger.getLogger(ConfirmComponentTag.class); 36 37 private String 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 50 public Component createComponent(RequestContext context) throws JspException { 51 try { 52 String xmlUri1 = (xmlUri != null) ? xmlUri : "/WEB-INF/wcf/confirm.xml"; 53 URL url = ResourceLocator.getResource(context.getServletContext(), context.getLocale(), 54 xmlUri1); 55 Document doc = XmlUtils.parse(url); 56 57 FormDocument.replaceI18n(context, doc, null); 59 60 return new ConfirmComponent(id, null, doc); 62 } catch (MalformedURLException e) { 63 logger.error(null, e); 64 throw new JspException (e); 65 } 66 } 67 68 72 public void setXmlUri(String xmlUri) { 73 this.xmlUri = xmlUri; 74 } 75 76 } 77 | Popular Tags |