velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carfield Yim <carfi...@carfield.com.hk>
Subject Re: Spring and JTidy
Date Tue, 11 Oct 2005 15:47:43 GMT
I've a simple method to get the output from velocity and press to
jtidy and do some validation, see if it useful to you:


	public static String getHtml(final File location, final Body body,
final Context context) throws Exception {
		final StringWriter writer = new StringWriter();
		context.templateMan.getTemplate(context).merge(context.templateMan.getContext(context,
body, location, new TestRequest()), writer);
		final ByteArrayOutputStream out = new ByteArrayOutputStream();
		final Tidy tidy = new Tidy();
		tidy.setXHTML(true);
		tidy.parse(new ByteArrayInputStream(writer.toString().getBytes()), out);
		//		System.out.println(out);
		return out.toString();
	}

On 10/11/05, Scott Edward Skinner <sskinner@cloud9.net> wrote:
> Is anyone using Velocity with Spring? What is the best way to incorporate
> JTidy? Looking over the VelocityView source, I see several places where I
> can intercept the Velocity output and send it to JTidy before passing it
> off to the response. Another possibility is to perhaps write a JTidy
> resolver and chain it to my VelocityViewResolver?
>
> -S
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message