Presentation is loading. Please wait.

Presentation is loading. Please wait.

Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Comparative Display Technologies.

Similar presentations


Presentation on theme: "Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Comparative Display Technologies."— Presentation transcript:

1 Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Comparative Display Technologies in Sakai Aaron Zeckoski azeckoski@gmail.com

2 2 What do we want out of a display technology? Easy to use for the developer Good separation of Code and UI –i.e. easy to use for the UI designer Good integration with Sakai –Portal, widgets, tools, etc…

3 3 What technologies work Virtually any Java related display technology can work in Sakai There are some caveats –Sakai uses a special Servlet to handle redirects and processing of HTTP request variables –Portal and widget interaction have to be developed for each technology Bottom line: You are better off sticking with the ones that currently work

4 4 What games are there in town? http://jakarta.apache.org/velocity/ http://java.sun.com/products/servlet/ http://java.sun.com/products/jsp/ JSF http://java.sun.com/javaee/javaserverfaces/ http://www2.caret.cam.ac.uk/rsfwiki/ But there are a few things to consider…

5 5 Java Servlets Intro modules of Java code that run in a server app to answer client requests HTML is hardcoded in the Java class –It can be pulled from external files though Most more advanced technologies are built on Servlets Sakai uses Servlet API 2.4 URL: http://en.wikipedia.org/wiki/Java_Servlethttp://en.wikipedia.org/wiki/Java_Servlet

6 6 Code Snippet package org.java.helloworld; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("Hello World"); } URL: http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-First-Servlets.htmlhttp://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-First-Servlets.html

7 7 Java Servlets + Tried and tested technology (1997) Runs on the server instead of on the client like an applet Pure Java code Session tracking via HttpServlet Works fine in Sakai –Café Servlet Hello World sample codeCafé Servlet Hello World sample code

8 8 Java Servlets - Invented in 1997 for goodness sake! HTML is placed in the Java class Impossible for UI designers to work with Poor separation of UI and Code Development this way is painful and slow compared to more modern methods

9 9 Java Servlets Final Why would you want to write pure Servlets any more considering the many better options out there? You are going to use Servlets anyway but at least use something along with it Bottom line: Don’t use this unless you just want to put an existing Servlet app into Sakai

10 10 Velocity Templates Intro Java based template engine Uses “references” to place dynamic content in html pages with # or $ vars –Somewhat similar to PHP or JSP Meant to allow UI designers to work alongside programmers Apache project URL: http://jakarta.apache.org/velocity/http://jakarta.apache.org/velocity/

11 11 Code Snippet Velocity Sample Hello $user.name #foreach( $item in $items ) #if ( $itemCheck($item) ) $item.value #end

12 12 Velocity Templates + Uses “references” to place dynamic content in html template pages –Somewhat similar to PHP or JSP Most used display technology in Sakai –Integration with Sakai is good Ok separation of UI and Code Decent docs and community

13 13 Velocity Templates - The current Velocity implementation in Sakai is a custom and out of date version Integration with Sakai is OK but not really being worked on much anymore New development in Velocity is discouraged by the community Mostly carried over from CHEF

14 14 Velocity Templates Final Go for technologies that provide better separation between Code and UI Bottom line: You are better off not using this, only use this if you have existing apps and cannot rewrite them

15 15 Java Server Pages Intro Dynamic Java web content scripting language –Very similar to PHP JSP pages are compiled into Servlets when accessed Pages are a mixture of HTML, taglib tags, and Code URL: http://java.sun.com/products/jsp/http://java.sun.com/products/jsp/

16 16 Code Snippet JSP Sample Hello Today is

17 17 Java Server Pages + Easy to develop in and work with Can be changed without restarting Works fairly well in Sakai –JSP support is available via a cool Servlet by Andrew Thornton (Cambridge) –Used in Rwiki (sorta), XML version Well tested technology with large community Excellent docs and many books

18 18 Java Server Pages - Mixes code and HTML together –Poor separation of code and UI design Compiled when accessed –This can cause a noticeable delay when accessing a page for the first time Integration with Sakai is poor Has many of the same weaknesses that other scripting languages have

19 19 Java Server Pages Final JSP support in Sakai is not great yet It is difficult for UI designers Bottom line: Use this if you have existing JSP code, but go for options that provider better separation between UI and Code for new projects

20 20 Java Server Faces Intro A Java based set of APIs for managing state, handling events, and defining navigation Mostly builds on JSP –Though it can be used without JSPs Includes a custom set of tag libraries Includes error handling, input validation, and internationalization support JSF URL: http://java.sun.com/javaee/javaserverfaces/http://java.sun.com/javaee/javaserverfaces/

21 21 Code Snippet JSF sample <h:dataTable id=“items" value="#{itemsBean.items}" var=“item"> JSF

22 22 Java Server Faces + The second most used display technology in Sakai (after Velocity) –Used for the portal and a small number of apps (Gradebook, Assignments, etc…) Integrates well with Sakai –better than any of the other current solutions (for now) MyFaces and Oracle ADF Faces Pretty good docs and books JSF

23 23 Java Server Faces - Pretty heavyweight and has problems in the current version –These might be fixed in the upcoming version Poor separation of UI design and code High learning curve Difficult to use and not very flexible Poor AJAX/Javascript integration Does not work with browser navigation JSF

24 24 Java Server Faces Final Most new apps in Sakai are written in this but it is recognized as having many weaknesses High learning curve and difficulty of use means slow development Bottom line: Don’t use this unless you really have to, even if you have existing code JSF

25 25 Reasonable Server Faces Spring based web programming framework Uses pure XHTML templates, clean separation of UI and Code Lightweight and pure bean programming Works well with AJAX and Javascript URL: http://jakarta.apache.org/velocity/http://jakarta.apache.org/velocity/

26 26 Code Snippet RSF sample Hello User Name Today is 1/1/2006 item value here

27 27 Reasonable Server Faces + Uses pure XHTML templates –Provides clean separation of UI and Code Respects the HTTP request cycle –Back button works! Works well with AJAX and Javascript Sakai integration and features are improving rapidly Good docs and code samples available on the RSF WikiRSF Wiki

28 28 Reasonable Server Faces - Greater separation of UI and code can require more files and lines of code –This is true of other solutions as well Not used in Sakai core yet but is fully functional in it and integrates somewhat –Some code in Sakai Contrib (rsf gallery)Sakai Contrib Small user community Still in development (also a positive)

29 29 Reasonable Server Faces Final The only really good separation of UI design and Code available Community support is growing and Sakai integration improving Bottom line: Use of this is recommended for new Sakai apps

30 30 Summary JSF No plain Servlets Velocity discouraged JSP ok for small stuff JSF is just bad RSF recommended


Download ppt "Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Comparative Display Technologies."

Similar presentations


Ads by Google