Download presentation
Presentation is loading. Please wait.
Published byMeryl McDonald Modified over 8 years ago
1
JSFTemplating https://jsftemplating.dev.java.net https://jsftemplating.dev.java.net ● Ken Paulsen – Senior Staff Engineer ● Sun Microsystems, Inc.
2
Welcome! What is JSFTemplating? Creating Pages Additional Features Developer Tips Questions? Agenda
3
Welcome! Now why are you here? I'm interested in JSF JSFTemplating got my attention I want to talk Ajax Pizza! (Thanks Nike!) PJUG Meeting, I come no matter what
4
What is JSFTemplating? JSF Page Framework? JSF Renderer Framework? Both! Oh... and it's Open Source too. https://jsftemplating.dev.java.net
5
Quotes “This is going really fast and I may just drop my current JSF/Facelets implementation on the floor for JSFTemplating." "...developed a GUI in a couple hours that would had took a day in JSF... (interesting.)"
6
Key Features Multiple format support #include pageSession Events / Handlers Factories Inter-operates w/ JSP Better Performance Instant changes AJAX Support
7
High Level Overview Template-based description of Renderer or UIComponent tree Template becomes "LayoutElement" tree (meta- data) LayoutViewHandler creates UIComponent tree TemplateRenderer walks tree
8
HTML Page test.jsf Web Browser High Level Overview – Page UIComponen t Tree next.jsf
9
HTML Produced Renderer component.jsf Output Stream High Level Overview – Renderer LayoutElemen t Tree
10
How to create JSFTemplating pages 1) Setup standard JSF environment 2) Put jsftemplating.jar in WEB-INF/lib 3) Put.jsf files in docroot (or classpath) 4) Try out your new.jsf pages!
11
Hello World! “Hello World! ~ “HelloWorld.jsf” 1 line
12
DEMO Hello World!
13
Another Example Page " " You typed: #{in}, try typing: abc " Type something and click 'Go!' " Congratulations! You did it! " "
14
DEMO Example #2
15
Creating Pages No compile time Instant changes (Debug Mode) No JSP problems Events and handlers are available > (hint: “info.jsf” to see a list) #include files
16
DEMO #include
17
Page Session Session pageSession Request
18
DEMO pageSession
19
initPage beforeCreate / afterCreate beforeEncode / encode / afterEncode command decode + more Events
20
Handler example (defining) @Handler(id="getUserResponse", input={@HandlerInput(name="userInput", type=String.class)}, output={@HandlerOutput(name="response", type=String.class)}) public static void calculateResponse(HandlerContext context) { // Get the input String in = (String) context.getInputValue("userInput"); // Business logic String resp = "Type something and click 'Go!'"; if (in != null) { if (in.equals("abc")) { resp = "Congratulations, you did it!"; } else { resp = "You typed " + in + ", try typing 'abc'."; } } // Set the response context.setOutputValue("response", resp); }
21
Handler example (using) <!beforeEncode getUserResponse(usrInput=”#{in}” response=>$pageSession{resp}); println(value=”We responded with: #{resp}”); /> <!command getUserResponse(usrInput=”#{in}” response=>$pageSession{resp}); println(value=”We responded with: #{resp}”); />
22
DEMO events / handlers
23
“One thing I absolutely believe is a waste of space is how SJSC2 has create four.java files per page.” Quote
24
Chainable Reusable Mappable I/O > EL Enabled > Automatic type conversion > Required field checking Handlers Reduces the amount of Code
25
Q: How can I find out what handlers are available? What Handlers? A: info.jsf
26
DEMO info.jsf
27
Alternate approach to “binding” Parameterizable Allows you to “extend” components w/o extending > DropDown > Table > Tree ComponentFactory's
28
ComponentFactory Example @UIComponentFactory(“sun:button”) public class ButtonFactory extends ComponentFactoryBase { public UIComponent create(FacesContext ctx, LayoutComponent descriptor, UIComponent parent) { UIComponent comp = ctx.getApplication(). createComponent(“com.sun.webui.jsf.Button”); if (descriptor.getOption("primary") == null) { comp.setValueBinding("primary", context.getApplication(). createValueBinding("#{true}")); } if (parent != null) { addChild(ctx, descriptor, parent, comp); } setOptions(ctx, descriptor, comp); return comp; }
29
Yes (but you may not want to) Can I use JSF JSP's with JSFTemplating?
30
DEMO Speed Test
31
DEMO Ajax Demos
32
Set DEBUG to true: com.sun.jsftemplating.DEBUG true Set your Log level: Developer Tips
33
Pretty URLs Better jMaki support Additional component library support Future Features...
34
GlassFish: https://glassfish.dev.java.net https://glassfish.dev.java.net jMaki: https://ajax.dev.java.net https://ajax.dev.java.net Dynamic Faces: https://jsf-extensions.dev.java.net https://jsf-extensions.dev.java.net JSFTemplating: https://jsftemplating.dev.java.net https://jsftemplating.dev.java.net References / Places to get involved!
35
GlassFish > GlassFish V2 Beta Available Feb 26 th > Contest for suggestions during 2 Month Beta > Discussions for GlassFish V3 starting now > User Experience Meetings Wed 12:00 -> 1:00 http://www.glassfishwiki.org/gfwiki/Wiki.jsp?page=UserExperienceMeeting JSF > JSF 2.0 JSR about to be formed JSF Components / Tools > NetBeans Visual Web Pack 5.5 Announcements
36
jMaki > Ajax Charting > https://jmaki-charting.dev.java.net https://jmaki-charting.dev.java.net > PHP Support DynamicFaces > Beta build tomorrow Announcements (more)
37
● Ken Paulsen – ken.paulsen@sun.com ken.paulsen@sun.com JSFTemplating https://jsftemplating.dev.java.net https://jsftemplating.dev.java.netQuestions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.