예제 #1
0
 public void Process(IDictionary context, TextWriter writer, string templateName)
 {
     try
     {
         Template template = base.GetTemplate(templateName);
         template.Merge(NVelocityEngineBase.CreateContext(context), writer);
     }
     catch (ResourceNotFoundException rnf)
     {
         writer.Write(rnf.Message);
     }
     catch (ParseErrorException pe)
     {
         writer.Write(pe.Message);
     }
 }
예제 #2
0
        public string Process(IDictionary context, string templateName)
        {
            StringWriter writer = new StringWriter();
            string       result;

            try
            {
                Template template = base.GetTemplate(templateName);
                template.Merge(NVelocityEngineBase.CreateContext(context), writer);
            }
            catch (ResourceNotFoundException rnf)
            {
                result = rnf.Message;
                return(result);
            }
            catch (ParseErrorException pe)
            {
                result = pe.Message;
                return(result);
            }
            result = writer.ToString();
            return(result);
        }