Thank you for the answer.

I see that properties are copied. But the property must be in javaBean spec.
otherwise subpropirties are not copied. I think that i can get previos
Action and manualy get whole property as object. The copy process in
ChainInterceptor rely on OGNL and  look like "magik".

If there is not any ability to get a previous action  and its properties
manually after ChainResult, I agree to rely on  ChainInterceptor.

I posted a detailed message 
http://www.nabble.com/-S2--NULL-Session-object-after-execAndWait-interceptor.-Why--tf4600442.html
 
about session object and strange behavior after execAndWait interceptor  


Ted Husted wrote:
> 
> The Action itself is not copied over, the PROPERTIES are copied. If
> the properties in common are copied forward, then there should be no
> need to address the prior Action class directly. Any methods that need
> to be called by more than one Action should be moved to a base support
> class that the Actions can share.
> 
> Also, there is rarely a need to use HTTP semantic in a Struts 2
> Action. The SessionAware and RequestAware interceptors expose the
> session and request attributes as entries in Maps. request.getSession
> doesn't work, because the interceptor doesn't pass the HttpRequest
> object but a map the proxies the attributes in request scope. If the
> Action needs access to the session attributes, then implement
> setSession(Map).
> 
> -Ted.
> 
> 
> On 10/11/07, Igor Vlasov <[EMAIL PROTECTED]> wrote:
>>
>> 1. I have "actionOne"
>>
>> public class ActionOne extends ActionSupport implements
>> ServletRequestAware{
>>   protected HttpServletRequest request;
>>
>>   private SearchParameter searchData=new SearchParameter();//My complex
>> object
>>
>>   public String execute() throws Exception{
>>      //fill searchData with parameters. Many many parameters.....
>>       return this.SUCCESS;
>>   }
>>
>>   // this is for ability to copy object searchData to next chain action
>>   public SearchParameter getSearchData() {
>>     return searchData;
>>   }
>>
>>   public void setServletRequest(HttpServletRequest httpServletRequest) {
>>     request = httpServletRequest;
>>   }
>>
>> }
>>
>> 2.
>>   <package name="searchEngine" namespace="/s2examples"
>> extends="struts-default">
>>     <action name="*search" class="s2.action.ActionOne" method="{1}"  >
>>       <result  name="success" type="chain" >doSearch</result><!--to
>> search
>> -->
>>       <result  name="input" >search.jsp</result> <!--input -->
>>     </action>
>>     <!-- специально сделана отдельно, чтобы на нее наложить execAndWait
>> -->
>>     <action name="doSearch" class="s2.action.ActionTwo"  >
>>       <interceptor-ref name="completeStack"/>
>>       <interceptor-ref name="execAndWait">
>>         2000
>>         500
>>       </interceptor-ref>
>>       <result  name="wait">wait_search.jsp</result>
>>       <result  name="success" type="redirect" 
>> >search_result.jsp</result>
>>     </action>
>>   </package>
>>
>> 3.
>> public class ActionTwo  extends ActionSupport implements
>> ServletRequestAware
>> {
>>   protected HttpServletRequest request;
>>   private SearchParameter searchData;
>>   private HttpSession sess;
>>   public String execute() throws Exception{
>>      sess = request.getSession();
>>      boolean v =(searchData!=null);// ok. we recieve a copy of searchData
>> from previos action
>>      try {  Thread.currentThread().sleep(6*1000);  } catch
>> (InterruptedException ex) {}
>>      sess = request.getSession(); // return null object!!! why ?
>>      return this.SUCCESS;
>>   }
>>   /*this work and  searchData object has been copied from previos action
>> */
>>   public void setSearchData(SearchParameter searchData) {
>>     this.searchData = searchData;
>>   }
>> }
>>
>> The desired behaviour:
>>
>> public class ActionTwo  extends ActionSupport implements
>> ServletRequestAware
>> {
>>   protected HttpServletRequest request;
>>   private HttpSession sess;
>>   public String execute() throws Exception{
>>      SearchParameter searchData=null;
>>      try {  Thread.currentThread().sleep(6*1000);  } catch
>> (InterruptedException ex) {}
>>      //!!!!
>>       ActionOne prev=null;
>>       prev=(ActionOne)getPreviousAction();
>>       searchData=prev.getSearchData();
>>      //!!!!
>>      sess = request.getSession(); // return null object!!! why ?
>>      return this.SUCCESS;
>>   }
>>
>> }
>> ===============================================================
>> for simplisity simplicity searchData may be a simple Object().
>> I need an ability to make : prev=(ActionOne)getPreviousAction();
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Manually-obtain-previous-action-parameters-after-action-%22chaining%22--tf4601173.html#a13155261
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to