[antlr-interest] ST# and ASP.NET
Christopher Brown
chris77550 at gmail.com
Fri Nov 23 08:02:13 PST 2007
Hi all,
As I mentioned in my previous post, I'm just starting out with ASP.NET and
ST#. I had a bit of difficulty finding examples of how to use ST# in
ASP.NET in the documentation and by searching around the Internet. Here's
the approach I used, just for information (if anyone is wondering) or for
comments (if there's a better way...). My file is "st1.aspx.cs".
- Christopher
________________________________________
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using Antlr.StringTemplate;
namespace websandbox
{
public partial class st1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "text/plain";
string templateFolder = Request.PhysicalApplicationPath +
"templates";
StringTemplateGroup myTemplates = new
StringTemplateGroup("myTemplates", templateFolder);
StringTemplate template = myTemplates.GetInstanceOf("st1");
template.SetAttribute("name", "chris");
Response.Write(template.ToString());
Response.End();
}
// don't use the ASPX rendering system, as we render everything in
Page_Load()
protected override void Render(HtmlTextWriter writer)
{
//base.Render(writer);
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071123/81a70c2a/attachment.html
More information about the antlr-interest
mailing list