JBOSSSEAM 1. seam2. 3. SEAM4. FaceletsJSF5. JSF6. 7. DomainModel8. 9. 10. 11. seamAJAXEJB3.0JSFBPMCRUD SeamSeam1Seam2FaceletsJSFFacelets1. dynamicwebproject2. jsfabilityfacelets3. web.xmljsf4. faces-config.xmlfaceletViewHandler5. beanfaces-config.xml6. 7. 8. Task: 1. faceletViewHandler 2. 3. seam componentcompositiondebugdecoratedefinefragmentcompositiondecoratefragmentcomponentUIComponentJavaBeanMap includeincludeFaceletcompositioncomponentXHTML/XML insertparamremoverepeatFacelets–1. ArequestcomesintoJavaServerFacesforanewview(orpage).TheFaceletViewHandlersimplycreatesanewUIViewRootforthisnewview. 2. Sincethisisanewviewbeingrequested,weimmediatelyrenderourview.Beforerendering,Faceletsneedstopopulatetheviewwithcomponents.Atthistime,theFaceletFactoryisusedtobuildaFaceletthatwillactasbuildinstructionsforthedesiredview.TheUIViewRootisappliedtotheFaceletandtheviewispopulatedforrendering. 3. TheUIViewRoot(view)isthenaskedtorenderitselfbacktotheresponse. 4. Theuserseesacompletedwebpageandthestateoftheviewisautomaticallystoredforthenextrequest.Note,alltheinlinedtextandothertransientcomponentswillnotbestored,only'crucial'componentinformationsuchasinputcomponentsandformdata. 5. Theuserclicksabutton,causingasecondrequesttocomebacktoJavaServerFaces.Thistime,theviewisrestoredfromthepreviouslystoredstate.Keepinmind,theviewatthispointonlyhasthe'crucial'componentsavailablefromthepreviousrequest. 6. ThisrestoredviewispassedthroughtheJavaServerFaceslifecycleandeventuallywewilleithergenerateanewviewforanotherpage,orre-renderyourcurrentviewiftherewerevalidationproblemsornoactionwasfired. 7. Inthecaseofre-renderingtheview,thepartialviewthatwasrestoredisnowrenderedagain.Beforeit'srendered,thesameFaceletisusedtore-populatethefullviewwithinlinedtextandtransientcomponents. 8. TheUIViewRoot(view)isthenaskedtorenderitselfbacktotheresponse. 9. Repeatthisprocessuntilanother(new)viewisrequested. JSFJSFMyseam-ear/Meta-inf/application.xml jboss-seam.jar 3 JSFFaces-config.xml jboss-seam.jar JSFSeamJSF JSF-page.xml--jPDLSeamcontextcomponentEJBBijectionSeam StandardDeploymentStrategy HotDeploymentStrategy WarRootDeploymentStrategy Seam: 1. Statelesscontext 2. Eventorrequestcontext 3. Pagecontext 4. Conversationcontext 5. Sessioncontext 6. Businessprocesscontext 7. Applicationcontext Useruser=(User)Contexts.getSessionContext().get(user); 1. EJB3.0statelesssessionbeans 2. EJB3.0statefulsessionbeans 3. EJB3.0entitybeans(i.e.,JPAentityclasses) 4. JavaBeans 5. EJB3.0message-drivenbeans 6. Springbeans Component.getInstance()@In(create=true) 1 2 org.jboss.seam.ScopeType org.jboss.seam.core • contextual-• bidirectional-outjected,• dynamic-Seam • SessionBeanBeanSeamEJB3.0@PostConstruct,@PreDestroy,SeamJavaBeanJ2EESeam@PostConstruct@PreDestroy. • @CreateSeam@Create• @DestroySeam@Destroy• SessionBean@RemoveSeam• @StartupApplicationSession@StartupSeamstartup@Startup(depends={....}) OLD NOW seamDomainModelDomainModelDomainModel domainmodel? domainmodel? xml DomainModelSEAMSeam•JSF •jBPM •Seam •Seam •Seam jsfJSFJSF h:commandButtonvalue=Clickme!action=#{helloWorld.sayHello}/ jbpmjBPMjBPM start-pagename=helloview-id=/hello.jsp transitionto=hello actionexpression=#{helloWorld.sayHello}/ /transition /start-page org.jboss.seam.validationFailed,JSF org.jboss.seam.preSetVariable.name org.jboss.seam.postSetVariable.name org.jboss.seam.preRemoveVariable.name org.jboss.seam.postRemoveVariable.name org.jboss.seam.preDestroyContext.SCOPE org.jboss.seam.postDestroyContext.SCOPE SEAMSeam1 2 3 404 JSF@Redirect XML JSFSeam–JSF Page.xml CODE jPDL–Contact:xue.anzhen@gmail.com