[java ee programming] Re: Struts2

2009-09-25 Thread Karl

Hi Alfredo,
Check this out here:
http://struts.apache.org/2.0.14/docs/tutorials.html

If you're new to struts the Passion! content (IMO) skims over a lot of details 
that are absolutely necessary to get the power of the framework.

--- On Mon, 9/21/09, Alfredo Torres alfredoluis.tor...@gmail.com wrote:
 Hi,
 
   I have read the struts2 presentaiton and hands on
 lab 2 times but i
 dont get it, i can not understand the structure, is there
 any other
 site that explain struts2 in more detail from the beggining
 whithout
 mix code??
 
 Thanks a lot for your answer



  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Java EE (J2EE) Programming with Passion! group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
-~--~~~~--~~--~--~---



[java ee programming] Re: Struts2

2009-09-21 Thread miga



On Sep 21, 8:39 pm, Alfredo Torres alfredoluis.tor...@gmail.com
wrote:
 Hi,

   I have read the struts2 presentaiton and hands on lab 2 times but i
 dont get it, i can not understand the structure, is there any other
 site that explain struts2 in more detail from the beggining whithout
 mix code??
Apart from this official struts site: http://struts.apache.org/, I
don't see.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Java EE (J2EE) Programming with Passion! group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
-~--~~~~--~~--~--~---



[java ee programming] Re: Struts2 Interceptors

2009-01-31 Thread Robert Krombholz

Urrrgs found the problem ... literal error in the interceptor definition :P

 Hi guys,

 I have a problem with a training project using Struts² and Hibernate.
 To encapsulate the crosscutting concern of Session and Transaction 
 handling of Hibernate, I
 tried to write my own Interceptor for my Actions that touches my 
 Service layer.

 The interceptor is very simple ... here is the code:

 public class HibernateTransactionInterceptor implements Interceptor 
 {public void destroy() {  }

public void init() {
}

public String intercept(ActionInvocation arg0) throws Exception {
Session sess = DAOUtil.getSessionFactory().openSession();
Transaction tx = sess.beginTransaction();
tx.begin();
String result = arg0.invoke();
if (result.equals(ActionSupport.ERROR)) {
tx.rollback();
}
else {
tx.commit();
}
sess.close();
return result;  }

 }

 I registered this interceptor in my Struts² configuration and use it 
 for all my actions that touches my service layer.
 But it seems that this interceptor is not called in the interceptor 
 chain.
 Here is the Struts² package definition:

package name=myPackage namespace=/ extends=struts-default
interceptors
interceptor name=transactionInterceptor

 class=org.gartenshop.interceptors.HibernateTransactionInterseptor/
/interceptors
   ...
   ...
action name=LoadArticleInformation 
 class=example.actions.LoadArticleInformation
 interceptor-ref name=transactionInterceptor/
!-- we don't define a result here because the action is 
 handling the request directly--
/action
   ...
/package

 When I try to load an object from my database this way, I always get 
 an Exception from Hibernate with the message:
 *load is not valid without active transaction.*
 In my opinion there is an active transaction bound to the Session 
 (because I opened it in the interceptor).
 I use DAOUtil.getSessionFactory().getCurrentSession() to get the 
 Session object opened by the Interceptor.
 Does anyone know where my fault is?


 Kind regards and thanks ahead
 Robert



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Java 
EE (J2EE) Programming with Passion! group.
To post to this group, send email to 
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to 
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~--~~~~--~~--~--~---