View
2
Download
0
Category
Preview:
Citation preview
1
Orientation in Objects GmbH
Weinheimer Str. 6868309 Mannheim
www.oio.deinfo@oio.de
Struts oder JavaServer FacesWA5
Version: 1.0
2© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Über mich
Papick Garcia Taboada
Software Architekt
Technologie-Scout
Beratung
Projekte
Training
2
3© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
) Akademie ) ) Beratung )
„Orientierung“ in Objekten
• Schulungen, Coaching, Weiterbildungsberatung, Train & Solve-Programme
• Methoden, Standards und Tools für die Entwicklung von offenen, unternehmens-weiten Systemen
• Schlüsselfertige Realisierungvon Software
• Unterstützung laufenderProjekte
• Pilot- und Migrationsprojekte
) Projekte )
4© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Überblick WA4
StrutsGrundidee StrutsWelche Probleme löst StrutsWelche Probleme löst Struts nichtWie löst Struts ProblemeTiles, die Rettung?Sackgasse Portale?Know-how-Kapital Struts
Hallo, Einführung und ZieleEine Webanwendung
ZwiebelsoftwareMission Impossible I & II
Sun's SpezifikationskeuleStruts und / oder JSF?
3
5© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Überblick WA5
Grundidee JSFJavaServer FacesWelche Probleme löst JSFWelche Probleme löst JSF nichtWie löst JSF ProblemeTiles, die Rettung?Tiles oder Portales?Knowhowkapital JSFZukunft: Struts Shale?
Hallo, Einführung und ZieleEine Webanwendung
ZwiebelsoftwareMission Impossible I & II
Sun's SpezifikationskeuleStruts und / oder JSF?
6© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Ziele
• Einblick in die WAFs aus Architektursicht vermitteln
– Einstieg in die Thematik
– Problemkreise identifizieren
– Lösungsansätze
– Entscheidungshilfe
4
7© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Eine Webanwendung
• Webanwendung := Web + Anwendung
– Web• Client/ Server Architektur• HTTP, HTML, CSS, JavaScript, Browser, TCP/ IP, Firewall, VPN, …
– Anwendung• Sitzungen
– Anwender– Berechtigungen– Sicherheit
• Anwendugsfälle– CRUD Operationen (Create, Retrieve, Update and Delete)– Workflows, Dialoge
8© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Zwiebelsoftware
• Java 2 Platform, Enterprise Edition (J2EE) defines the standard for developing component-based multitier enterprise applications.
– Web Tier– Business Tier– EIS-Tier
5
9© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Wo ist mein MVC?
• Model-View-Controller in der Vogelperspektive
• Gesamtes System wird Betrachtet
Web ServerServlet Engine
Präsentation
Logik
EIS
JSPJSPServletServlet
Application Server
EJBEJBCorbaCorba
EJBEJB RMIRMI
BeanBean
10© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Webapplication
GlobalNavigationsControllerGlobalNavigationsController
ActionAction
ActionAction
ActionAction
ProcessControllerProcessController
AppContextAppContext
ProcessContextProcessContext
FormBeansFormBeans
LayoutControllerLayoutController
UIComponentUIComponent
UIComponentUIComponent
UIComponentUIComponent
NavigationsControllerNavigationsController
Model View
Controler
„Wo ist mein MVC“ Reloaded
• MVC-Perspektive wird auf die Architektur der Webanwendung verschoben
• In einer Webanwendung zu finden: – Navigation– Anzeige– Zustände
6
11© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Mission Impossible I
• aka Model-1 Architektur• Globale Navigation und
Prozesse sind durch HTML-Links abgebildet
• Sehr einfach zu implementieren
• Besondere Erschwernisse– Bei Wartungarbeiten– Bei Änderungswünsche
• „Broken Link Melden“-Anwendungen
Index.jsp
E D Person AE D Person B
New Person
editperson.jsp
NameLastname
Save Cancel/ Go Back
reallysaveperson.jsp
Really Save?
Yes No
saveperson.jsp
Person saved,Click HERE to continue!
pid=2
reallydeleteperson.jsp
Really Delete?
Person B
Yes No
deleteperson.jsp
Person deleted,Click HERE to continue!
newperson.jsp
NameLastname
Create Cancel
createperson.jsp
Person was created!Click HERE tocontinue…
12© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Mission Impossible II
• aka Model-2 Architektur
• Navigation und Prozesse in Objekte festgehalten
• Nur „logische“Navigation in den JSPs
• JSP Fragementewiederverwendbar
homeServlet
param action=?
Null Edit Create Delete Save Message
listServlet persistSerlveteditServlet messageServlet
list.jspf
E D Person AE D Person B
New Person
action=(edit|delete|create)&pid=X
deleteServlet
form.jspf
FirstnameLastname
Save Cancel
message.jspf
Message:
Yes | No | Cancel
action=save&pid=X
action=message&pid=X&message=savedOK
7
13© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
No comments
14© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Sun‘s Spezifikationskeule
• Zu viele Frameworks– Schwer zu entscheiden– Qual der Wahl– Kein Standard
• Fehlende „offizielle“ Alternative zu Microsofts ASP .net WebForms
• Die Keule: JavaServer Faces
– Standard Webframework für J2EE Anwendung
– Anerkennung durch Software-Industrie
8
15© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Struts und / oder JSF?
• Einfach dargestellt hört Strutsda auf wo JSF anfängt
• Eigentlich klingt das gut, nur das Struts und JSF ganz unterschiedlich funktionieren
„Struts“-Anwendung „JSF“-Anwendung
JSF
Struts
Struts
JSF
?
16© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Überblick WA5
Grundidee JSFJavaServer FacesWelche Probleme löst JSFWelche Probleme löst JSF nichtWie löst JSF ProblemeTiles, die Rettung?Tiles oder Portales?Knowhowkapital JSFZukunft: Struts Shale?
Hallo, Einführung und ZieleEine Webanwendung
ZwiebelsoftwareMission Impossible I & II
Sun's SpezifikationskeuleStruts und / oder JSF?
9
17© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
JavaServer Faces
• JavaServer Faces ist ein Framework zur Erzeugung von Benutzeroberflächen– RAD – Lückenfüller im J2EE Puzzle– Antwort auf Microsofts ASP .net WebForms– Eventbasierte UI-Programmierung– Umfangreiche API, erweiterbares Komponentenmodell– Toolsupport
• Spezifiziert durch die JSR 127 – Durch Craig R. McClanahan geleitet
18© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Grundidee JSF
• „Paradigmenwechsel“– Eventbasierte UI
Programmierung in WebAnwendungen
• JSF „Laufzeitumgebung“wandelt Request/ Response Browserdialog in Ereignisse
• UI definieren kein HTML– rendern des UI durch
sogenannte Renderer
editperson.jsp
NameLastname
Save Cancel/ Go Back
client
server
10
19© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Events, Events, Events, …
Restore viewRestore view
Unmarshall request valuesUnmarshall request values
Process EventsProcess Events
Process validationsProcess validations
Process EventsProcess Events
Update model valuesUpdate model values
Process EventsProcess Events
Invoke ApplicationInvoke Application
Process EventsProcess Events
Render responseRender responseRender responseRender response
Simplified requestprocessing lifecycle
Errors, listener skips other phases
Errors, listener renders response
20© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Welche Probleme löst JSF?
• Ereignisbasierte UI Programmierung
– Toolunterstützung
• Technologieneutrale Maskenbeschreibung
• Standardisierung und offene Schnittstellen, dadurch
– Komponenten und Rendererverschiedener Hersteller sind austauschbar, zueinander kompatibel
Webapplication
GlobalNavigationsControllerGlobalNavigationsController
ActionAction
ActionAction
ActionAction
ProcessControllerProcessController
AppContextAppContext
ProcessContextProcessContext
FormBeansFormBeans
LayoutControllerLayoutController
UIComponentUIComponent
UIComponentUIComponent
UIComponentUIComponent
NavigationsControllerNavigationsController
Model View
Controler
11
21© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Wie löst JSF Probleme?
• Durch Definition einer API und der Umwandlung des Request-Response Zyklus in Events
• Durch Definition von Schnittstellen für die Entkopplung der
– Renderer und– Komponentenbiliotheken
JSF LaufzeitumgebungJSF Laufzeitumgebung
RendererRenderer
BeansListener
XML
Komponenten-bibliotheken
Komponenten-bibliotheken
JSPs
APIAPI
Listener
Listener
BeansBeans
Beans
JSPsJSPs
JSPs
XML
Listener
request response
22© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Welche Probleme löst JSF nicht?
• Keine Spezifikation für Templates (Tiles)
• Kein globales Exceptionhandling
• Fortgeschrittene Navigation
– Mehrspaltige Webanwendungen
– Dialoge– Workflows
Webapplication
Model View
Controler
GlobalNavigationsControllerGlobalNavigationsController
ActionAction
ActionAction
ActionAction
ProcessControllerProcessController
AppContextAppContext
ProcessContextProcessContext
FormBeansFormBeans
LayoutControllerLayoutController
UIComponentUIComponent
UIComponentUIComponent
UIComponentUIComponent
NavigationsControllerNavigationsController
NavigationsControllerNavigationsController
NavigationsControllerNavigationsController
12
23© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Tiles, die Rettung?
• Tiles wird aktuell aus Strutsentkoppelt, als eigenständiges Projekt weitergeführt
• Realisiert das „compositepattern“ für Webanwendungen!
• Eventuell einsetzbar
– als Template-Mechanismus für JSF
– zur Erstellung von mehrspaltigen Webanwendungen
navigation content
header
24© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Beispiel: JaxJSF
13
25© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Projektübersicht
26© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Alles ist Architektur
Bauen beginnt im Kopf
14
27© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Tiles oder Portales?
Portale bieten die Funktionalität an, die in JSF fehlt
• Aufteilung der Oberfläche in Teilbereiche• Templates• Erweiterte Navigationsmöglichkeiten• Infrastruktur für modulare Softwarekomponenten
Je nach Projekt darf entschieden werden…
• ob die Infrastruktur selber implementiert werden soll,• oder ein Portal-Produkt eingesetzt werden kann…
28© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Know-how-Kapital JSF
• Ereignisbasierte, komponentenbasierte Softwareentwicklung findet man in vielen Technologien wieder
– AWT – Swing– SWT
• Eclipse RCP
• Fortgeschrittene Softwareentwicklung– objektorientiert– komponentenbasiert– Anwendung vieler bekannter Entwurfsmuster
15
29© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Gesichertes Kapital?
• Ja!
– Portale als Anwendungsplatform, JSF als Maskenbeschreibung
– Technologie wurde durch Industrie angenommen, inzwischen breite Toolunterstützung
– Das gerenderte User Interface entsteht aus einer neutralen Maskenbeschreibung, durch Austauschen des Renderers neue Client-Technologien erreichbar
• siehe AJAX
30© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Zukunft: Struts Shale?
• Einige Artikel im Internet beschreiben, dass Struts JSF-fähiggemacht wird…
– Dabei wird sich Struts grundlegend ändern, sodass die Weiterführung des Namens „Struts“ bei den Entwicklern umstritten ist.
– Das „JSF-Struts“, vielleicht auch „Struts Shale“ genannt, hat sehr wenig mit dem heutigen Struts gemeinsam…
• Hier: keine Einführung in Struts Shale, nur ein paar Eindrücke…
16
31© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Zitate aus „Shale Cometh“
„Struts is old-school and is no longer the best Java-based web application framework. IMO, it's not even in the top 3. As a Struts committer, I will always have a soft spot for Struts, butlet's face it: over the past 4 years many advances have beenmade in WAF technology and, mostly due to backwardcompatibility considerations, Struts has not kept up.“
32© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Zitate aus „Shale Cometh“
„I love Struts and I always will, but it's time to move forward.“
17
33© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
Zitate aus „Shale Cometh“
„Shale is a framework built on JSF initiated by Craig McClanahan. Craig is trying to get the Struts developmentcommunity to adopt Shale as Struts 2.0, but ironically, he'sgetting some push back from developers who don't want Shaleto be the next Struts because Shale is an entirely different framework that has absolutely no ties whatsoever to Struts-as-we-know-it.“
Orientation in Objects GmbH
Weinheimer Str. 6868309 Mannheim
www.oio.deinfo@oio.de
? ?
???
Fragen ?
18
35© 2005 P.G.TaboadaJAX 2005 / Struts oder JSF?
„OIO-JAX Scrabble“ Gewinnspiel
• Spielen Sie mit uns eine Runde OIO-JAX Scrabble und gewinnen Sie ein OIO Seminar aus dem Bereich
• „Scrabble-Felder“ bekommen Sie an unserem Konferenzstand.• Abgabe bis Donnerstag, 12.05.05 - 11.45 Uhr
• Gewinnbekanntgabe: 12.05.05 - 14.10 Uhr
• Wir freuen uns über Ihren Besuch. Viel Spass beim Scrabbeln!
UECO S
NE
PRO
OIXJ A@O
Orientation in Objects GmbH
Weinheimer Str. 6868309 Mannheim
www.oio.deinfo@oio.de
Vielen Dank für IhreAufmerksamkeit !
Recommended