struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sri Sankaran" <Sri.Sanka...@sas.com>
Subject RE: Using different actionform types before and after a display page.
Date Wed, 19 Mar 2003 16:21:40 GMT
What do you mean by "does not seem to work"?  Do you get null values? NPE?

Is your ActionFormA still in scope (available) in SetupActionB?  In other words, can you get
a non-null value for either of

  request.getAttribute("ActionFormA.key");

or
 
  session.getAttribute("ActionFormA.key");

Sri
-----Original Message-----
From: Susan Bradeen [mailto:SusanB@softlanding.com] 
Sent: Tuesday, March 18, 2003 3:23 PM
To: struts-user@jakarta.apache.org
Subject: Using different actionform types before and after a display page.


I normally use the same *type* of action form before and after my jsp 
pages, but what if the jsp submits to an action that uses a different type 
of action form, but contains a few of the same fields that I'd like to use 
in that second action? Can I retrieve the submitted values (coming from 
one action form type) to use in an action with a different action form 
type?

Too confusing? :-)

If I have ... 
   SetupActionA, using its ActionformA, to display A.jsp
and ... 
   SetupActionB, using its ActionformB, to display B.jsp

Now say that my A.jsp contains a form that submits to SetupActionB. 

If the ActionformA and the ActionformB contain a few identical fields, is 
it correct that the parameters submitted from A.jsp can be retrieved and 
used by my ActionformB in the SetupActionB? 

public class SetupActionA extends Action {
    public ActionForward execute(...) throws Exception {
        ActionformA formA = (ActionformA) form;
       formA.setMyID(someID);
       formA.setMyName(someName);
      ... etc
   }
}
 
public class SetupActionB extends Action {
    public ActionForward execute(...) throws Exception {
        ActionformB formB = (ActionformB) form;
       formB.setMyID(*** get this from the A.jsp parameters ***);
       formA.setMyName(*** get this from the A.jsp parameters ***);
      ... etc
   }
}

My tests so far have been unsuccessful, especially for <html:hidden> field 
values. I know that I can use request.getParameter("myID"), for values 
submitted by the html form, but this does not seem to work for 
<html:hidden> fields. 

I think I am getting tripped up by an elementary Struts concept 
(ActionForm instances?), but my brain seems to be up against a brick wall 
at the moment. 

Thanks for any clarification.

Susan Bradeen
 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message