A short overview Dipl Inform Volker Reichel VRSoft
- Slides: 51
A short overview © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 1
� Seam is a web application framework based on Java. Server Faces which aims to simplify web development by reducing XML configuration tasks � Seam web applications can be deployed in EJB 3 containers but this is not a must � Seam provides an embedded EJB 3 container � Seam does not need EJB 3 features at all. It works fine with POJO and JPA. © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 2
� This presentation is not intended to provide a full description of all the features available in Seam. � It is the authors intend to present the key features and configuration hints � For feedback please send mail to seam@vrsoft. de © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 3
Seam © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 4
SEAM Framework JDK 1. 5 or later JSF EJB 3 1. 1 1. 2 EJB 3 Embedded EJB 3 Container © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 5
© Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 6
Or • sacrifice EJB support • All Seam features available • Security • Pageflow • Exception handling • Enhanced JSF Expression Language (JSF-EL) © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 Web container • Use embedded EJB 3 Java EE container J 2 EE container Decide on how your Seam application will be deployed • Use embedded EJB 3 Or • sacrifice EJB support 7
Seam © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 8
JBoss Seam © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 9
� Form Backing Beans �Directly supported by JSF �The targets of JSF forms �Bring data into JSF pages � Action Listener �Target of form submission & links �Implementation of the MVC controller �Performing business logic � Browser Accessible Components �Accessing EJBs or POJOs via Java. Script (AJAX) © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 10
POJO Stateless Session Bean Statefull Session Bean Entity Bean Message Driven Bean Component ++ -- ++ ++ -- Backing Bean ++ ++ ++ -- -- Action Listener -- ++ ++ -- -- Browser Comp. © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 11
Container and your Seam Application © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 12
© Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 13
What needs to be done to get SEAM in place? © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 14
© Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 15
What needs to be done to get a Seam application running? 1. Bundle Seam core libraries with your application (ear or war) 2. Configure Facelets Facelet. View. Handler (for basic Seam features) Seam. Facelet. View. Handler (enhanced JSF-EL, security) 3. Configure web application environment Seam JSF Phase Listener Seam Servlet Listener 4. Configure Seam features (optional) Seam. Filter & Filter Mapping prepares Exception Handling & Validation © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 16
con tinu ed What needs to be done to get a Seam application running? 5. Configure EJB components Seam. EJBInterceptor EJB Beans declarations (optional) 6. Enable optional Seam components Security Pageflow j. BPM 7. Define / Configure Behavior Actions Navigation Error Handling Conversation Management Security © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 17
� If you are developing a web application using a war-archive then put jboss-seam. jar in myapp/WEB-INF/lib directory � If you are developing an enterprise application (ear) then put jboss-seam. jar in root of the EAR archive and reference the jboss-seam. jar module as shown on the next slide in your application. xml Replace the highlighted regions according with your application © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 18
<? xml version="1. 0" encoding="UTF-8"? > <application xmlns="http: //java. sun. com/xml/ns/javaee" xmlns: xsi="http: //www. w 3. org/2001/XMLSchema-instance" xsi: schema. Location="http: //java. sun. com/xml/ns/javaee/application_5. xsd" version="5"> <display-name>My. App</display-name> <module> <web-uri>myapp. war</web-uri> <context-root>/myapp</context-root> </web> </module> <ejb>myapp-ejb. jar</ejb> </module> <!-- Seam and EL --> <module> <java>jboss-seam. jar</java> </module> </application> © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 19
� Put �Java. Server Faces (jsf-facelets. jar) �Expression Language API (el-api. jar �EL-Reference Implementation (el-ri. jar) into your webapp classpath i. e. WEB-INF/lib � Set view-handler in faces-config. xml to �com. sun. facelets. Facelet. View. Handler If you want basic Facelet support �org. jboss. seam. ui. facelet. Seam. Faclet. View. Handler If you want enhanced features like JSF EL, validation, security © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 20
� Seam needs to register itself with JSF in order to receive events during request processing. Therfore we have to add a Seam. Phase. Listener to faces-config. xml. <faces-config> … <lifecycle> <phase-listener> org. jboss. seam. jsf. Seam. Phase. Listener </phase-listener> </lifecycle> … </faces-config> © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 21
� Seam contexts and core services are managed by a Seam. Servlet. Listener which you have to setup in web. xml. <web-app> … <listener> <listener-class> org. jboss. seam. servlet. Seam. Listener </listener-class> </listener> … </web-app> © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 22
� Some Seam features which can be configured in components. xml need a basic web filter � you have to add the definitions shown on the next slide to web. xml © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 23
<web-app> … <servlet> <servlet-name>Seam Resource Servlet</servlet-name> <servlet-class>org. jboss. seam. servlet. Resource. Servlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Seam Resource Servlet</servlet-name> <url-pattern>/seam/resource/*</url-pattern> </servlet-mapping> <filter-name>Seam Filter</filter-name> <filter-class>org. jboss. seam. web. Seam. Filter</filter-class> </filter> <filter-mapping> <filter-name>Seam Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> …</web-app> © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 24
� Validation � multi-part form submission � Validation � And other features are only available when jboss-seam-ui is in the classpath of the webapp. Therefore you have to put jboss-seam-ui. jar into webapp/WEB-INF/lib directory. © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 25
� In order to use Seam EJB components you have to install the Seam EJB Interceptor which is done your ejb-jar. xml file. <ejb-jar> … <assembly-descriptor> <interceptors> <interceptor-class>org. jboss. seam. ejb. Seam. Interceptor</interceptor-class> </interceptor> <interceptor-binding> <ejb-name>*</ejb-name> <interceptor-class>org. jboss. seam. ejb. Seam. Interceptor</interceptor-class> </interceptor-binding> </assembly-descriptor> … </ejb-jar> © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 26
� Step 5 is a necessary prerequisite for this step! � Components. xml is used to configure Seam components. Either predefined ones or your own components. � Typically you will only enable predefined components like security here. � Your own components are made accessible via the @Name annotation in your source! But if you like you can configure your components here also. © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 27
� If you are going with EJB 3. 0 you have to provide a JNDI pattern for the lookup of these EJBs. <components> … <component name=“org. jboss. seam. core. init”> <property name=“jndi. Pattern”>my. App/#{ejb. Name}/local</property> </component> … </components> #{ejb. Name} will expand to your EJB’s name during runtime Make sure seam. properties is in your META-INF directory. The file does not need to have contents © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 28
� Behavior is specified in pages. xml which is optional � There are � Page Trigger activity before a page is invoked � Page navigation Same as navigation rules in faces-config. xml Since faces-config. xml is for Facelets page navigation should be defined here for consistency � Error actions handling redirect to a page, show JSF message, end conversation � Manage conversation properties Start, end � Security declare security constraints on pages, roles, users © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 29
JBoss Seam © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 30
Contexts provide a mechanism for data access. Seam provides the following contexts: Session Spans Application Spans belongs to the page Conversation Spans as long as the current HTTP-Request Page Data as long as the web application is running Request Spans the full HTTP-Session across several HTTP-Requests Workspace Spans several sessions (i. e. users) and conversations (more like a business process) © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 31
Implicit v are default v each request is wrapped in an implicit conversation Explicit Java pages. xml @Begin / @End on method Conversation. XXX begin end join nest JSF Page © Dipl. -Inform. Volker Reichel, VRSoft, 2007 @action=“#{conversation. XXXX}” in <page>-Element v f: param conversation. Propagation or v @propagation in seam: link-Element 9/18/2020 32
JBoss Seam © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 33
Restore View Apply Request Values Determine target view & create / restore it Update UI components with request data Render Response Invoke Application Refresh the view Run application callbacks / action listeners © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 Process Validations Run registered validators Update Model Values Update managed beans 34
JBoss Seam © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 35
� Seams Pageflow uses JBoss’s j. BPMs Process Definition Language (j. PDL) � j. PDL has a different syntax than BPEL � j. PDL can be used to describe pageflows � j. PDL is different from <navigation-rule>Syntax � j. PDL consists of �States �Events / Outcomes �Transitions © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 36
� Can be mixed with JSF navigation � By default disables “back” button functionality � Good for modal or wizard-driven UI flows � Good separation of flow and UI © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 37
� Add <component class=“org. jboss. seam. core. Jbpm”> <property name=“pageflow. Definitions”> <value>flow_A. jpdl. xml</value> <value>flow_B. jpdl. xml</value> </property> </component> to components. xml � Put the flow file (*. jpdl. xml) into the web apps classpath. For security reasons flows should be stored in <webapp>/WEB-INF/classes © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 38
j. PDL JSF/Seam State A JSF View A Event E Outcome X Action. Listener. action. Method return value © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 State B JSF View B 39
Seam © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 40
� Provided as predefined component (identity) � Delegates implementation to user-defined class � Supports declarative security settings �i. e. JRules (drools. jar) � Fine-grained �Finest security level is method & instance � Needs facelets � Needs jboss-seam-ui. jar in classpath � Needs Seam. Facelet. View. Handler © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 41
Pages Components Methods <page …> <restrict> </page> <page login-required=“true”> … </page> pages. xml © Dipl. -Inform. Volker Reichel, VRSoft, 2007 @Restrict annotation in Java Code either on class or individual method *. java 9/18/2020 42
© Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 43
Seam © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 44
JSF Page POJO Facade Session EJB POJO Facade Entity EJB Managed Bean Session EJB JSF Page Automatically wrapped in Managed Bean © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 Entity EJB 45
Seam Features © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 46
� Injection allows passing information from outside into an object � Injection is executed typically once during initialization of the object � Bijection passes information into an object and allows information to be exported from an object � Bijection happens whenever needed not only at initialization time � Bijections is controlled via @in / @out annotations © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 47
© Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 48
� Situation � JBoss 4. 2. x and 5. x are using JSF Reference Implementation (which is JSF 1. 2) while 4. 0. 5 uses Apache My. Faces � Solution � Make sure “My. Faces” listener (org. apache. myfaces. webapp. Startup. Servlet. Context. Listener) is commented out in the listener sections of web. xml � Remove “el-ri. jar” and “el-api. jar” from application. xml � Make sure you are using the application and lifecycle settings provided on the next slide. Please check the namespace declaration and version attribute! © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 49
<faces-config version="1. 2" xmlns="http: //java. sun. com/xml/ns/javaee" xmlns: xsi="http: //www. w 3. org/2001/XMLSchema-instance" xsi: schema. Location="http: //java. sun. com/xml/ns/javaee/web-facesconfig_1_2. xsd"> <application> <el-resolver>org. jboss. seam. jsf. Seam. ELResolver</el-resolver> </application> <lifecycle> <phase-listener> org. jboss. seam. jsf. Seam. Phase. Listener </phase-listener> </lifecycle> <!-- more configurations go here --> </faces-config> © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 50
� Software �JBoss Seam http: //labs. jboss. com/jbossseam �JBoss AS http: //labs. jboss. com/jbossas � Books �Practical JBoss Seam Projects, Jim Farley, Apress �JBoss Seam Simplicity and Power Beyond Java EE, Michael Juntao Yuan & Thomas Heute, Prentice Hall © Dipl. -Inform. Volker Reichel, VRSoft, 2007 9/18/2020 51
- Vrsoft
- Tall+short h
- Reichel foods inc
- Reichel foods
- Osnove zdravstvene njege
- Dipl wirt inf
- Stefan trninic
- Dipl med techn
- Truppmann 1 niedersachsen
- Unpack armadillo
- Volker jost
- Volker bothmer
- Prof. dr. volker hoffmann
- Volker mertens
- Volker iceblue
- Volker prahl
- Volker kirchhoff
- Hypercavs
- Volker friese
- Volker pispers zitate
- Volker quetschke
- Dr. med. volker schmiedel
- Volker schaa
- Volker römermann ehefrau
- Volker quade
- Volker weidner
- Volker markl
- Volker seeker
- Volker wenke
- Ano ang maikling kwento
- Heterozygous short-hair x heterozygous short-hair
- Gmb software
- Accu chek inform ii glucometer
- Purpose inform persuade entertain
- Storyte;
- Example of informational texts
- Www.informdelivery.con
- Inform and persuade
- The prince punishes romeo by
- Accuchek inform
- What is inform entertain persuade
- Accu chek critical values
- Inform persuade remind
- Aforestdrip
- Inform text adventure
- Accu chek inform ii quiz answers
- Accu-chek inform ii competency test answers
- A speech to inform
- How all occasions do inform against me
- Writing to inform
- Inform educate and empower public health
- Offer 3 hali