struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neethiraj, Selvamohan" <>
Subject RE: Two ActionForms in one action
Date Thu, 01 Aug 2002 20:30:26 GMT
If I understand your question correctly,  you want to set a FIXED value for an attribute in
the FORM that is invoked by your next ACTION.
Why can't you set this FORM2() object in your request by doing the following in your Action
associated with the first FORM:

	FORM2  lNewFormTwo = new FORM2() ;
	lNewFormTwo.setAttribute(Value) ;    # This is your method in FORM2 Object
	request.setAttribute("FORM2", lNewFormTwo) ;

Then, the next view (JSP)  that takes the value from this Object  and place it as a Hidden
variable or a Read-Only variable using the following code:

		FORM2  lForm = request.getAttribute("FORM2") ;
		If (  lForm != null )
		<INPUT TYPE="hidden" NAME="Attribute"  VALUE="<%= lForm.getAttribute() %>">

This way,  you are passing value to the next View and then, it gets passed to the Next action
when the next view SUBMITS its form.


 -----Original Message-----
From: 	Marco Maier [] 
Sent:	Thursday, August 01, 2002 4:10 AM
Subject:	Two ActionForms in one action


is it possible to preset a form in an action that is associated with 
another form.

For example:
I have the action Action1 with the name attribute Form1

public class Action1 extends Action

public ActionForward execute(ActionMapping mapping, ActionForm form,
        		HttpServletRequest request, HttpServletResponse response
throws Exception
   // get values from form1
   Form1 form1 = (Form1) form;
   System.out.println("Day: " + form1.getDay());
   System.out.println("Month: " + form1.getMonth());
   System.out.println("Year: " + form1.getYear());
   // put values to business layer
   // get results from business layer

   // set results to another form (for example Form2)
   Form2 form2 = new Form2();

   // forward to Action2 that is associated with Form2
   return mapping.findForward(RPKConstants.SUCCESS_KEY);

In Action2 I will get the preset values from Form2.
How does my action-mapping looks like
if this is possible?
Are there any alternatives?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message