• Post Reply Bookmark Topic Watch Topic
  • New Topic

Forcing JSF to output malformatted HTML  RSS feed

 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I am using JSF and I need to force it to output (through a Facelets' include) an HTML file which does not follow the XML conventions (i.e. an HTML that a normal browser would accept but JSF will refuse to include because of things like certain tags do not have the matching end-tags).

I usually get those ugly HTML files trough programs like Word. I am not allowed to change them but I still want to make JSF output them.

My code looks something like this:




Any idea how to do it?
[ December 27, 2007: Message edited by: Joseph Sweet ]
 
Tim Holloway
Bartender
Posts: 18716
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you REALLY want to produce bad HTML? I visited a fairly large city last week and attempted to read the online edition of their local newspaper on my phone's web browser (Mobile Internet Explorer). All I got was a completely white page. There's too much bad HTML out there as it is.

There are two types of "bad" HTML. One is where the tags are mismatched, like so:

This (i)(b)is(/i)(/b) bad.

Old versions of Word used to do this, and it shouldn't have. The correct form is, of course:

This (i)(b)is(/b)(/i) good.

The other, where there's no closing tag isn't strictly speaking bad, but it annoys parsers. However you can make a tag self-contained and that makes it OK. For example:

<br/> or <p>

This is basically what XHTML is all about - you make sure that you adhere to a consistent case in the tags, a ala XML (no <h1>Pagfe title<H1>) and tags that are either explicitly closed, or standalone.

Normally, XHTML is what I output from my JSF apps.

As far as I know, just because there are apps like MS-Word that produce defective HTML, that doesn't mean that the apps that consume it prefer bad HTML themselves. At best it means someone's got to keep the importer in sync with the exporters. And in an environment like Microsoft's where there's virtually no commitment to backwards compatibility, that's probably a losing game anyway.
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes please, I need to know if and how that thing that I have asked about can be done with JSF.

Just like in Math. It's just good to know if I can tell JSF to do that. Then we can discuss if there is something practical to do with that knowledge.
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I guess everyone is determined to protect me from littering the web with bad HTML!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!