2. Cagatay Civici
• JSF Expert Group Member (JSR-314)
• PrimeFaces Founder and Lead
• Apache MyFaces PMC Member
• Atmosphere Ajax Push/Comet
Committer
• Regular Speaker, Author, Technical
Reviewer
• Co-founder of Prime Technology
3. Prime Technology
• Agile and Java EE Consulting
• JSF, Spring, Seam, JPA
• Trainings (e.g. PrimeFaces, JSF 2.0)
• Outsource Development
• Istanbul/Turkey based
4. What is this about?
• PrimeFaces Component Suite
• RIA
• Ajax Push
• TouchFaces
• iPhone/Android/Palm
• GPS Navigation
• Mock OS X with JSF
• Interested?
8. Design Principles
• A good UI component should hide
complexity but must keep flexibility
• Page author must be in full control
• Do not overuse JSF extensions
• Avoid extensions that can cause race
conditions
• Avoid bringing overhead, keep it clean!
9. UI Components
• 70+ Rich set of components
• Ajax powered or Client side
• YUI, jQuery and PrimeFaces widgets
• Unobstrusive Javascript
• Customizable and Easy to Use
• Compatible with “others”
• Skinning
30. Callback Arguments
<p:commandButton value=”Submit” action=”#{bean.save}”
oncomplete=”handleComplete(xhr, status, args)” />
public void save() {
RequestContext context = RequestContext.getCurrentInstance();
context.addCallbackParam(“item”, item);
}
• From backing bean to ajax callbacks with
JSON
<script type=”text/javascript”>
function handleComplete(xhr, status, args) {
alert(args.item.name);
}
</script>
31. Ajax Remoting
public class GreetingBean {
private String name;
//...
public void toUpperCase() {
name = name.toUpperCase();
}
}
• p:remoteCommand
<p:remoteCommand name=”upperCase”
actionListener=#{greetingBean.toUppterCase} />
<script type=”text/javascript”>
upperCase();
</script>
32. PPR Summary
No Need For
• Simple
Ajax Servlet Filter
• Easy to Use
Html Parser
• Flexible
• Responsive Ajax ViewHandler
• Lightweight Ajax StateManager
• Keep it clean Ajax Regions
Ajax*
41. Chat App in a Minute
public class ChatController {
private String message;
public void send(ActionEvent event) {
CometContext.publish(“chat”, message);
}
//getters setters
}
<h:form>
<h:inputText value=”#{chatController.message}” />
<p:commandButton value=”Send” actionListener=”#{chatController.send}” />
</h:form>
<p:outputPanel id=”display” />
<p:push channel=”chat” onpublish=”handlePublish” />
<script type=”text/javascript”>
function handlePublish(pushed) {
! $('#display').append(pushed.data);
}
</script>
42. Pushing as JSON
Player player = new Player();
player.setName(“Messi”);
player.setAge(22);
CometContext.publish(player);
function handlePublish(pushed) {
//pushed.data.name;
//pushed.data.age;
}
48. Enterprise Support
• 2/4 hour average response time
• Priority forum access
• Ticket based portal
• IM support over skype
• JSF specific help
• Special Case Support