Web Information Systems (WE-DINF-11912): Lecture 07 - Web Application Frameworks

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

2 comments

Comments 1 - 2 of 2 previous next Post a comment

  • + signer Beat Signer 5 days ago
    You’re welcome! There will be a few more handouts for the Web Information Systems course ...
  • + Almawali112 Almawali112 5 days ago
    Thanks to you
Post a comment
Embed Video
Edit your comment Cancel

Favorites, Groups & Events

Web Information Systems (WE-DINF-11912): Lecture 07 - Web Application Frameworks - Presentation Transcript

  1. Web Information Systems Web Application Frameworks Prof. Beat Signer Department of Computer Science Vrije Universiteit Brussel http://vub.academia.edu/BeatSigner 2 December 2005
  2. Web Application Frameworks A web application framework is a software framework that is designed to support the development of dynamic websites, Web applications and Web services. The framework aims to alleviate the overhead associated with common activities performed in Web development. For example, many frameworks provide libraries for database access, templating frameworks and session management, and often promote code reuse. [http://en.wikipedia.org/wiki/Web_application_framework] November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 2
  3. Web Application Frameworks ...  A web application framework supports the development of dynamic websites, Web Services or web applications  offers libraries and tools to deal with web application issues - template libraries - session management - database access libraries  Some frameworks also offer an abstraction from the underlying enabling technologies  Leads to faster and more robust development process  Many frameworks follow the Model-View-Controller (MVC) design pattern  no mix of application logic and view (as for example done in JSP) November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 3
  4. Model-View-Controller (MVC)  Business logic handled by the model  when the state of a model changes, it notifies its views - a model can have multiple views  Design aspects handled by the view  renders the data of the model  notifies the controller about changes notifies View  Controller handles requests selects view  processes input and modifies Controller gets the model state notifies Model modifies state November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 4
  5. Apache Struts 2  Free open source framework for creating enterprise- ready Java-based web applications  Brings the MVC pattern into a web application framework  model - Java beans and other helper classes - completely up to the developer how to implement the model  view - template-based approach often based on JavaServer Pages (JSP) in combination with tag libraries  controller - based on Java Servlet technology in combination with filters  Standard development process for any Struts 2 web application November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 5
  6. Apache Struts 2  Simplifies web development  conventions over configuration  reasonable default values reduce size of configuration files  Action-based MVC2 (Pull MVC) framework  MVC2 slightly different from MVC - model represented by Action (POJO); view can pull information from the action  separation of application logic (POJOs) and view components  ValueStack  temporary objects, Action objects, ...  access from JSP via Object Graph Navigational Language (OGNL)  Multiple view alternatives  JSP, XSLT, Velocity, ... November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 6
  7. Apache Struts 2 MVC2 View 6 JSP 1 4 Browser Controller Servlet 5 3 Model 2 JavaBeans Database November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 7
  8. Apache Struts 2 ...  Apache Struts does not require any changes to the servlet container  regular servlet application  Fosters modularity and loose coupling November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 8
  9. Apache Struts 2 Architecture  Servlet request  standard filter chain - interception of requests and responses - reusable modular units - e.g. XSLT transformation  FilterDispatcher consults controller (ActionMapper)  ActionProxy is called if action has to be executed  consult Configuration- Manager  create ActionInvocation [http://struts.apache.org/2.x/docs/architecture.data/Struts2-Architecture.png] November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 9
  10. Apache Struts 2 Architecture ...  invoke any interceptors (controller) before Action  Action class updates the model  ActionInvocation does a lookup for the Result  based on Action result code  mappings in struts.xml  Result execution (view)  often based on JSP template  interceptors in reverse order  Send response [http://struts.apache.org/2.x/docs/architecture.data/Struts2-Architecture.png]  filter chain November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 10
  11. Apache Struts 2 web.xml <web-app id="WebApp1" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <filter> <filter-name>struts</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> <init-param> <param-name>actionPackages</param-name> <param-value>be.ac.vub.wise</param-value> </init-param> </filter> <filter-mapping> <filter-name>struts</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <taglib> <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri> <taglib-location>/WEB-INF/struts-bean.tld</taglib-location> </taglib> ... </web-app> November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 11
  12. Tag Libraries  Introduced to encapsulate reusable Java objects in JSP  provide access to methods on objects  Apache Struts 2 offers four different libraries  HTML - e.g. buttons, form fields, ...  Template  Bean - e.g. definitions, parameters,  Logic - e.g. comparisons, ... November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 12
  13. Apache Struts 2 Hello World Example <%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <title>Hello World</title> </head> <body> <h1><s:property value="message"/></h1> <p>Time: <b><s:property value="currentTime" /></b></p> </body> </html> HelloWorld.jsp November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 13
  14. Apache Struts 2 Hello World Example ... package be.ac.vub.wise; import com.opensymphony.xwork2.ActionSupport; import java.util.Date; public class HelloWorldImpl extends ActionSupport { public static final String MESSAGE = "Hello World!"; private String message; public String execute() throws Exception { setMessage(MESSAGE); return SUCCESS; } public void setMessage(String message){ this.message = message; } public String getMessage() { return message; } public String getCurrentTime(){ return new Date().toString(); } } HelloWorldImpl.java November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 14
  15. Apache Struts 2 Hello World Example ... <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.enable.DynamicMethodInvocation" value="false"/> <constant name="struts.devMode" value="true"/> <package name="wise" namespace="/wise" extends="struts-default"> <action name="HelloWorld" class="be.ac.vub.wise.HelloWorldImpl"> <result>/pages/HelloWorld.jsp</result> </action> ... </package> ... </struts> struts.xml  Execute the Hello World example by send a request to  http://localhost:8080/wise/HelloWorld.action November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 15
  16. Adobe Flex  Adobe's software development kit for cross-platform Rich Internet Applications (RIAs) based on Adobe Flash  Two main components  Adobe Flash player 9 runtime environment  Free Flex SDK - compiler and debugger, the Flex framework and user interface components  Adobe Flex Builder (commercial) - Eclipse plug-in with MXML compiler and debugger  Separation of user interface and data  user interfaces described in MXML markup language in combination with ActionScript - similar to AJAX funtionality discussed earlier - compiled into flash executable (SWF) November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 16
  17. Microsoft Silverlight  Microsoft's platform for Rich Internet Applications  Runtime requires a browser plug-in  Internet Explorer, Firefox and Safari  Silverlight Core Common Language Runtime (CoreCLR)  A Silverlight application consists of  CreateSilverlight.js and Silverlight.js - initialise the browser plug-in  user interface described in the Extensible Application Markup Language (XAML) - XAML files not compiled  indexable by search engines  code-behind file containing the program logic  Programming based on a subset of the .NET Framework November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 17
  18. Microsoft Silverlight ...  Silverlight 3 introduced a set of powerful new features including  LocalConnection API - communicate asynchronously with multiple applications on the same machine  out-of-browser experiences - Silverlight applications can be installed locally for accessing them offline - cross-platform with Windows/Mac  Two types of Silverlight web requests  WebClient class - OpenReadAsync (for streaming), DownloadStringAsync as well as uploads  WebRequest - based on HttpWebRequest - register asynchronous callback handler November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 18
  19. Microsoft Silverlight ...  Becoming a competitor to Adobe Flash  Moonlight is an open source implementation of Silverlight and is developed as part of the Mono project November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 19
  20. OpenLaszlo  Open source RIA platform  Two main components  LZX programming language - XML and JavaScript  OpenLaszlo Server  The Open Laszlo Server compiles LZX applications into different possible runtime components  Java Servlets  DHTML  binary SWF files November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 20
  21. Ruby on Rails  Open source web application framework  Combination of  dynamic, reflective, object-oriented programming language Ruby - combination of Perl-inspired syntax with "Smalltalk" features  web application framework Rails  Based on MVC architecture pattern  The scaffolding feature offered by Rails can automatically generate some of the models and views that are required for a website  developer has to run an external command to generate Ruby code November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 21
  22. Ruby on Rails  Ruby on Rails Philosophy  Don't Repeat Yourself (DRY) - information should not be stored redundantly (e.g. do not store information in configuration files if the data can be automatically derived by the system)  Convention over Configuration (CoC) - programmer only has to specify unconventional application settings (e.g. naming conventions to automatically map classes to database tables) November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 22
  23. Video: Ruby on Rails http://media.rubyonrails.org/video/rails_blog_2.mov November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 23
  24. Web Content Management Systems  Content management systems that focus on web content  Main functionality  data storage and publishing, user management (including access rights), versioning, workflows  Offline (create static webpages), online (create webpages on the fly) and hybrid systems  Often some kind of server-side caching  Suited for non-technical users since the underlying technology is normally completely hidden  Web CMS Examples  Joomla, Drupal, ... November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 24
  25. References  Apache Struts 2  http://struts.apache.org/2.x/  Microsoft Silverlight video  http://silverlight.net/learn/videos/silverlight-videos/net-ria-services- intro/  Ruby on Rails Video: Creating a Weblog in 15 Minutes  http://media.rubyonrails.org/video/rails_blog_2.mov November 5, 2009 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 25
  26. Next Week Semantic Web 2 December 2005

+ Beat SignerBeat Signer, 2 weeks ago

custom

285 views, 0 favs, 2 embeds more stats

This lecture is part of a Web Information Systems c more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 285
    • 277 on SlideShare
    • 8 from embeds
  • Comments 2
  • Favorites 0
  • Downloads 18
Most viewed embeds
  • 7 views on http://wise.vub.ac.be
  • 1 views on http://www.slideshare.net

more

All embeds
  • 7 views on http://wise.vub.ac.be
  • 1 views on http://www.slideshare.net

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories