HTML and CSS Reference
In-Depth Information
Listing 10-5.
Mashups4JSF Dependency in pom.xml
<project ...>
...
<dependencies>
...
<dependency>
<groupId>com.googlecode.mashups4jsf</groupId>
<artifactId>mashups4jsf-core</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
<version>0.9</version>
</dependency>
</dependencies>
<repositories>
...
<repository>
<id>
googlecode.com
</id>
</repository>
</repositories>
</project>
After adding Mashups4JSF jars to our application's dependency, we can include it in our XHTML page as follows:
<html xmlns="
http://www.w3.org/1999/xhtml
"
xmlns:ui="
http://java.sun.com/jsf/facelets
"
xmlns:h="
http://java.sun.com/jsf/html
"
xmlns:mashup="
http://code.google.com/p/mashups4jsf/
"
>
The weather page has a
logout CommandLink
whose action is binded with the
logout
method of the
WeatherBacking
bean class. Listing 10-6 shows WeatherBacking bean class.
Listing 10-6.
WeatherBacking Bean Class
package com.jsfprohtml5.weather.backing;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
@Named
@RequestScoped
public class WeatherBacking extends BaseBacking {
public String logout() {
getSession().invalidate();
return "/home.xhtml?faces-redirect=true";
}
}