Académique Documents
Professionnel Documents
Culture Documents
Scripting
Struts, JSF, Ruby on Rails and Ajax
Struts
Struts is popular framework used to develop MVC based web
application.
The framework is designed to streamline the full development
cycle, from building, to deploying and to maintaining applications
over time.
R. LOGAMBIGAI, TA
December 8, 2016
Features of Struts
Tag support - Struts2 has improved the form tags and the new tags
allow the developers to write less code.
Struts Components
The Model-View-Controller pattern in Struts is realized with
following five core components:
1. Actions
2. Interceptors
3. Value Stack / OGNL (Object Graph Navigation Language)
4. Results / Result types
5. View technologies
R. LOGAMBIGAI, TA
December 8, 2016
R. LOGAMBIGAI, TA
December 8, 2016
R. LOGAMBIGAI, TA
December 8, 2016
R. LOGAMBIGAI, TA
December 8, 2016
R. LOGAMBIGAI, TA
December 8, 2016
JSF
Java Server Faces (JSF) is a MVC web framework that
simplifies the construction of user interfaces (UI) for
server-based applications by using reusable UI components
in a page.
The JSF specification defines a set of standard UI
components and provides an Application Programming
Interface (API) for developing components. JSF enables the
reuse and extension of the existing standard UI
components.
R. LOGAMBIGAI, TA
December 8, 2016
Benefits of JSF
proving reusable UI components
10
R. LOGAMBIGAI, TA
December 8, 2016
JSF Architecture
MVC design pattern designs an application using three separate
modules:
Module
Description
Model
Carries Data and login
View
- Shows User Interface
Controller Handles processing of an application.
A JSF application is similar to any other Java technology-based web
application; it runs in a Java servlet container, and contains
JavaBeans components as models containing application-specific
functionality and data
A custom tag library for representing event handlers and validators
A custom tag library for rendering UI components
11
R. LOGAMBIGAI, TA
December 8, 2016
JSF Architecture
UI components represented as stateful objects on the
server
Server-side helper classes
Validators, event handlers, and navigation handlers
Application configuration resource file for configuring
application resources
12
R. LOGAMBIGAI, TA
December 8, 2016
JSF Architecture
13
R. LOGAMBIGAI, TA
December 8, 2016
14
R. LOGAMBIGAI, TA
December 8, 2016
15
R. LOGAMBIGAI, TA
December 8, 2016
AJAX
AJAX stands forAsynchronousJavaScript andXML. AJAX is
a new technique for creating better, faster, and more
interactive web applications with the help of XML, HTML, CSS
and Java Script.
Ajax uses XHTML for content and CSS for presentation, as
well as the Document Object Model and JavaScript for
dynamic content display.
AJAX allows web pages to be updated asynchronously by
exchanging small amounts of data with the server behind the
scenes. This means that it is possible to update parts of a web
page, without reloading the whole page.
Classic web pages, (which do not use AJAX) must reload the
entire page if the content should change.
16
R. LOGAMBIGAI, TA
December 8, 2016
AJAX
Conventional web application transmit information to and from
the sever using synchronous requests. This means you fill out a
form, hit submit, and get directed to a new page with new
information from the server.
With AJAX when submit is pressed, JavaScript will make a
request to the server, interpret the results and update the
current screen.
17
R. LOGAMBIGAI, TA
December 8, 2016
Working of AJAX
18
R. LOGAMBIGAI, TA
December 8, 2016
19
R. LOGAMBIGAI, TA
December 8, 2016
Ruby
Ruby is a pure object oriented programming language.
Ruby is a general-purpose, interpreted programming language like
PERL and Python.
Ruby Syntax:
Whitespace characters such as spaces and tabs are generally
ignored in Ruby code, except when they appear in strings.
Ruby interprets semicolons and newline characters as the ending
of a statement. However, if Ruby encounters operators, such as +,
-, or backslash at the end of a line, they indicate the continuation
of a statement.
Identifiers are names of variables, constants, and methods. Ruby
identifiers are case sensitive. It mean Ram and RAM are two
different identifiers in Ruby.
Ruby comments start with a pound/sharp (#) character and go to
EOL. R. LOGAMBIGAI, TA
December 8, 2016
20
Ruby
Ruby Data Types:
Basic types are numbers, strings, ranges, arrays, and hashes.
Variable Types:
$global_variable
@@class_variable
@instance_variable
[OtherClass::]CONSTANT
local_variable
21
R. LOGAMBIGAI, TA
December 8, 2016
Ruby
Ruby Pseudo-Variables:
They are special variables that have the appearance of local
variables but behave like constants. You can not assign any value to
these variables.
self: The receiver object of the current method.
true: Value representing true.
false: Value representing false.
nil: Value representing undefined.
__FILE__: The name of the current source file.
__LINE__: The current line number in the source file.
22
R. LOGAMBIGAI, TA
December 8, 2016
23
Top to bottom:
:: .
[]
**
-(unary) +(unary) ! ~
*/%
+<< >>
&
|^
> >= < <=
<=> == === != =~ !~
&&
||
.. ...
=(+=, -=...)
not
and or
R. LOGAMBIGAI, TA
December 8, 2016
body
elsif bool-expr [then]
body
else
body
end
2. unless bool-expr [then]
body
else
body
end
24
R. LOGAMBIGAI, TA
December 8, 2016
25
R. LOGAMBIGAI, TA
December 8, 2016
26
R. LOGAMBIGAI, TA
December 8, 2016
Rails
An extremely productive web-application framework.
Written in Ruby.
You could develop a web application at least ten times faster
with Rails than you could with a typical Java framework.
An open source Ruby framework for developing databasebacked web applications.
Your code and database schema are the configuration!
No compilation phase required.
27
R. LOGAMBIGAI, TA
December 8, 2016
Features of Rails
Metaprogramming :Other frameworks use extensive code
generation from scratch. Metaprogramming techniques use
programs to write programs. Ruby is one of the best languages for
metaprogramming, and Rails uses this capability well. Rails also uses
code generation but relies much more on metaprogramming for the
heavy lifting.
Active Record :Rails introduces the Active Record framework,
which saves objects to the database. The Rails version of Active
Record discovers the columns in a database schema and
automatically attaches them to your domain objects using
metaprogramming.
Convention over configuration:Most web development frameworks
for .NET or Java force you to write pages of configuration code.
If you follow suggested naming conventions, Rails doesn't need
much configuration.
28
R. LOGAMBIGAI, TA
December 8, 2016
Rails
Scaffolding:You often create temporary code in the early stages
of development to help get an application up quickly and see how
major components work together. Rails automatically creates much
of the scaffolding you'll need.
Ajax at the core: Ruby on Rails has a great support for Ajax
technology and it is part of the core libraries.
Built-in testing:Rails creates simple automated tests you can then
extend. Rails also provides supporting code called harnesses and
fixtures that make test cases easier to write and run. Ruby can
then execute all your automated tests with the rake utility.
Three environments:Rails gives you three default environments:
development, testing, and production. Each behaves slightly
differently, making your entire software development cycle easier.
29
R. LOGAMBIGAI, TA
December 8, 2016
30
R. LOGAMBIGAI, TA
December 8, 2016
R. LOGAMBIGAI, TA
December 8, 2016
R. LOGAMBIGAI, TA
December 8, 2016
33
R. LOGAMBIGAI, TA
December 8, 2016
References
http://www.exadel.com/tutorial/jsf/jsftutorial-kickstart.html
34
R. LOGAMBIGAI, TA
December 8, 2016
35
R. LOGAMBIGAI, TA
December 8, 2016