I am using eclipse juno and I am trying to build a website. I am building the User interface and I would like to use JSF. The following code runs and when I run the file the information is displayed correctly on the screen.
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="Stylesheets/flashcard.css" />
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:form>
<h:commandButton value="Click"></h:commandButton>
</h:form>
</f:view>
However I have read that it is better practice to write the code like this. This code just displays a blank page.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="Stylesheets/flashcard.css" />
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:form>
<h:commandButton value="Click"></h:commandButton>
</h:form>
</f:view>
</body>
</html>
The difference is subtle but in the second file I don't use jsp <%@ tags if this makes sense. When creating the second file I chose JSF xhtml or something. Does anybody know what the problem might be?