Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for 
change notification.

The "JEE-Annotation" page has been changed by LennyPrimak:
http://wiki.apache.org/tapestry/JEE-Annotation?action=diff&rev1=2&rev2=3

Comment:
Added Stateful Session Bean support

  = How to make @EJB Annotation work in Tapestry pages and components =
  
  This works on Tapestry 5.3 or higher.
- Has been tested with Glassfish 3.1
+ Has been tested with Glassfish 3.1.
+ 
+ Keep in mind this only works for Stateless session beans,
+ for stateful beans, see the usage example below.
  
  == In your AppModule.java file, add the following method ==
  
@@ -127, +130 @@

  
  }}}
  
+ == Using Stateful Session Beans in your client code ==
+ 
+ {{{
+ 
+ class SomeTapestryPage
+ {
+     @SetupRender
+     private void init()
+     {
+         if(statefulBeanExists == false)
+         {
+             statefulBean = new 
JNDIObjectLocator().getObject(MyStatefulBeanLocal.class);
+         }
+ 
+         if(statefulBean2 == null)
+         {
+             statefulBean2 = new 
JNDIObjectLocator().getObject(MyStatefulBeanLocal.class);
+         }     
+     }
+ 
+ 
+     @SessionState(create = false) private MyStatefulBeanLocal statefulBean;
+     private boolean statefulBeanExists;
+ 
+     // another example
+     @Persist private MyStatefulBeanLocal statefulBean2;
+ }
+ 
+ }}}
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org

Reply via email to