Yes - I've got some complex tags and the resultant HTML has loads of
redundant whitespace in all the wrong places. Trying to compare with
original mock-ups takes for ever.
I like doing this with a filter because it's easy to remove if I'm having
problems later. I've just got it working and it's doing what I want. I
appreciate it may cause problems later...
The correct config is: -
<filter-mapping>
<filter-name>JTidyFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>StrutsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
It was just the ordering of the filters that was causing problems.
Is there a better way of tidying up the HTML being emitted from a Struts
View?
Kind Regards,
Steve
-----Original Message-----
From: Dave Newton [mailto:[email protected]]
Sent: 30 September 2012 18:05
To: Struts Users Mailing List
Subject: Re: How to pretty print HTML from Struts
Ugh. IMO relying on textual representation of a DOM is fragile and broken,
especially if you're unable to ignore whitespace-is there a reason you're
doing it like this?
Dave
(pardon brevity, typos, and top-quoting; on cell) On Sep 30, 2012 12:22 PM,
"Steve Higham" <[email protected]> wrote:
> My Struts Views are made up of JSP and Tiles and the resulting HTML is
> untidy to say the least. This causes problems when I try to compare it
> with HTML mock-ups. To solve this I'm trying to use the JTidy library
> to pretty print the HTML output to the browser.
>
>
>
> I'm using the JTidyFilter configured as follows: -
>
>
>
> <filter-mapping>
>
> <filter-name>StrutsFilter</filter-name>
>
> <url-pattern>/*</url-pattern>
>
> </filter-mapping>
>
>
>
> <filter-mapping>
>
> <filter-name>JTidyFilter</filter-name>
>
> <url-pattern>/*</url-pattern>
>
> </filter-mapping>
>
>
>
> This seems to be failing because the Struts Filter Dispatchers only
> pass the request down the Filter Chain if it is not a Struts Request
> (e.g.
> *.action).
> Therefore this config will try to pretty-print *.css, *.js, *.img etc.
> but completely ignores the outputs of my actions.
>
>
>
> Does anyone know a sensible way of pretty printing the Struts HTML
> output to the browser?
>
>
>
> Many Thanks,
>
>
>
> Steve
>
>
>
> Steve Higham
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]