Simple HTML5 Friendly Markup Sample

From a demo done by David Heffelfinger (who has a great Java EE 7 screencast series here), on HTML5 friendly markup.

index.xhtml: 

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:jsf="http://xmlns.jcp.org/jsf">
    <title>Data Entry Page</title>
    <body>
        <form method="POST" jsf:id='form'>
            <table>
                <tr>
                    <td>Name:</td>
                    <td><input jsf:id='name' type="text" jsf:value="${person.name}" /></td>
                </tr>
                <tr>
                    <td>City</td>
                    <th><input jsf:id='city' type="text" jsf:value="${person.city}"/></th>
                </tr>
                <tr>
                    <td><input type="submit" value="Submit" jsf:action="confirmation" /></td>
                </tr>
            </table>
        </form>
    </body>
</html>

confirmation.xhtml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Data Confirmation Page</title>
    </head>
    <body>
        <h1>#{person.name}</h1> from <h2>#{person.city}</h2>
    </body>
</html>

Person.java:

package org.demo;

import javax.enterprise.inject.Model;

@Model
public class Person {
    
    String name;
    String city;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }
    
}

Related info:

http://jsflive.wordpress.com/2013/08/08/jsf22-html5/

http://hantsy.blogspot.nl/2013/08/jsf-22-html5-support.html

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« July 2015
SunMonTueWedThuFriSat
   
4
7
11
12
20
29
30
31
 
       
Today