jsf 2 ui:include .html give error "XML Parsing Error: no element found" - html

I include a header.html (not .xhtml) to my page, but when I preview my page, it give me error "XML Parsing Error: no element found". I do know that it is the tag no properly closed issue, but since my header page is a html file, not a xhtml file, it shouldn't must close the tag, am I right?
If I do close all the meta tag in my header.html, my page is working fine, but I wish to know that is it a must close all the tag properly in html file if I include them in jsf2, thanks.
header.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Header</title>
<meta name="description" content="">
</head>
<body>header content</body>
</html>
welcome1.xhtml
<ui:include src="header.html" />
<p>welcome page</p>

From Oracle's documentation, <ui:include> is used to encapsulate and reuse content among multiple XHTML pages. The src attribute is expected to point to a well-formed XML document. Even if you want to include .html pages, you need to make sure all tags are closed properly.

If you look more closely, you will see the closing <html> tag in you header.html, which should end the HTML document, as you can see in Structure of an HTML document. This way, when you include the file in the final view you break that contract.
In JSF you'd be better off using the templating option of facelets. For example in a master template you can make insert points, like the scripts section, and later define inserted contents in template client pages (final views). Kickoff example can be found in this tutorial by mkyong.

Related

Pelican blog - Verify ownership Bing webmaster

To verify ownership of my blog, the bing webmaster requires one of the following three approaches:
Upload the file "BingSiteAuth.xml" to my website as https://mywebsite/BingSiteAuth.xml
Copy and paste a meta tag in my default webpage e.g. <meta name="msvalidate.01" content="...." />
An example given:
<html>
<head>
<meta name="msvalidate.01" content="...." />
<title>Your SEO optimized title</title>
</head>
<body>
page contents
</body>
</html>
Add CNAME record to DNS
Question:
What would be the easiest approach and what would be the steps for a beginner ?
Note I am using the AboutWilson template in Pelican. Thanks
Sounds like the copy and paste meta tag would be the easiest, i have done it on my blog. All you need to do is go to your theme template directory and paste the required meta tag line in the base.html file in the head section.

HTML <meta> tag

I am reading a Servlet "HellowWorld" tutorial. The servelet is defined in a HelloWorldServelet.java class. Super simple to output "Hell world" message to the client request. The only html file is "index.html" below. I don't understand how the meta tag works. As I run the application in the web server, it automatically this page with the URL:
http://localhost:8080/helloworld/HelloWorld
How the attributes "http-equiv" and "content" work together with the servelet?
<html>
<head>
<meta http-equiv="Refresh" content="0; URL=HelloWorld">
</head>
</html>
The Refresh meta-tag automatically redirects the browser to the URL given after the specified amount of time.
Without seeing the tutorial you are using, I can't imagine why you would need to use it for your task.
https://en.wikipedia.org/wiki/Meta_refresh
"http-equiv" and "content"
they are used for adding message headers in http response .
For example http-equiv can be used to refresh the page.
if you specify something like this
<meta http-equiv="refresh" content="45">
you are instructing browser to refresh in every 45 seconds.
Other than refresh,you can use it to set cookies and etc.

Is it possible to package multiple HTML files in an MHTML file and navigate between them?

So I might be thinking of the wrong file format, but I remember as a kid opening files that looked like a Windows 98 help window:
I thought it was an MHTML file, and it allowed me to navigate between the packaged pages. Am I thinking of the right format?
MHTML allows HTML with links as a standalone file, as described here. Many online tools will create one for you.
.MHT files are also single HTML files.
Winfows 98 actually used a compiled HTML file - ie a .CHM
When I needed something similar, I created a frameset in main.htm file like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>My framed webpage</title>
</head>
<frameset cols="25%,*">
<frame src="toc.htm">
<frame src="content.htm" name="content">
</frameset>
</html>
toc.htm - table of contents, a list of links referred to content.htm file by id (with list of elements Link Title Name with ids toc_0 ... toc_n). Right frame in result file.
content.htm - content file with links with ids toc_0 ... toc_n you want to refer to. They might be any h* elements. Left frame in result file.
If you use Java, then Jsoup is your best friend.
<frameset> tag is deprecated HTML tag The tag is not supported in HTML5
UPD. When you have three files main.htm, toc.htm and content.htm just open a main one. Previously there was a flag in Chrome experimental features to save as a MHTL and you had only to activate it, but now seems they have removed it.
However you can use a Save as MHTML add-on instead.

When is an xmlns declaration in HTML5 really necessary [duplicate]

This question already has answers here:
What does "xmlns" in XML mean?
(5 answers)
Closed 7 years ago.
I'm trying out different web page compositors and most of them start out with a basic structure like this when I create a new project:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Web Project</title>
</head>
<body>
<h1>New Web Project Page</h1>
</body>
</html>
I wasn't really able to find an answer as to why there needs to be an xmlns if it's going to be a normal web page. I know I can omit it if I so desire, I've been writing HTML5 documents before and it was working fine without it.
So when is it actually necessary to provide an xmlns in the <html> element and why do compositors think it should be there when I create a new project? Is there any significance providing an xmlns with the <html> tag when doing HTML5 in the first place? Is there any benefit adding it?
On a regular HTML5 page you don't need it. However, if you want XML-serialized HTML5 (i.e. XHTML) then you add the XML namespace. For example the web framework JSF uses XML-serialized HTML, so there would be one reason to use it.
The HTML validator at http://w3.org does not complain when the xmlns attribute is missing in an XHTML document. This is because the namespace "xmlns=http://www.w3.org/1999/xhtml" is default, and will be added to the tag even if you do not include it.
From http://www.w3schools.com/tags/att_html_xmlns.asp

Convert shared layout of asp.net to html

I recently figured that hosting a microsoft webdomain is expencive. Therefore I want to change my website to a simple HTML file with JScript and Css.
Does anyone know how i change this code from the shared-layout of my project to normal HTML code that i can paste into my index page?
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>#ViewBag.Title</title>
#Styles.Render("~/css/style.css")
#Styles.Render("~/Content/css")
#Styles.Render("~/Content/bootstrap.css")
#Styles.Render("~/css/animate.css")
#Styles.Render("~/css/animations.css")
#Styles.Render("~/css/custom.css")
</head>
<body>
#RenderBody()
#Scripts.Render("~/bundles/jquery")
#RenderSection("scripts", required: false)
</body>
Just display any page from your web site in your browser, right click on the page, and select "View page source". Copy and paste that into a new file - the HTML is all there. No need to worry about what the above Render functions do as you are capturing the HTML after it has been rendered! Next add lines to the head section to link each .css file (keeping the same order as in the original script, that's important), and move copies of those files to your new site, and that should be it.