doubt about JSF 2 and Facelets

UI Components for JSF
Post Reply
Spiderbezno
Posts: 35
Joined: 16 Sep 2010, 10:41

01 Oct 2010, 14:46

The JSF 2 use as standard Facelets, in the previous version JSF 1.2 the standard was JSP, in Facelets us the XHTML,
about next code which is beter to use

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
 <body>
  <form jsfc="h:form">
   <span jsfc="h:outputText" value="Welcome, #{loggedInUser.name}" disabled="#{empty loggedInUser}" />
   <input type="text" jsfc="h:inputText" value="#{bean.property}" />
   <input type="submit" jsfc="h:commandButton" value="OK" action="#{bean.doSomething}" /> 
  </form>
 </body>
</html>
or this(all examples of primefaces use this option)

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
 <body>
  <h:form>
   <h:outputText value="Welcome, #{loggedInUser.name}" disabled="#{empty loggedInUser}" />
   <h:inputText value="#{bean.property}" />
   <h:commandButton value="OK" action="#{bean.doSomething}" /> 
  </h:form>
 </body>
</html>

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

01 Oct 2010, 15:11

Both are same, first one has the advantage of getting recognized by regular HTML editors. If you don't use a visual html editor, I suggest the second way.

Spiderbezno
Posts: 35
Joined: 16 Sep 2010, 10:41

01 Oct 2010, 15:38

thanks optimus.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 51 guests