Hi,

I tried getting properties values from cashFlowForm in addCashFlowSuccessfully.jsp but 
didn't work. Can I get the DynaActionForm property values in a JSP using bean.write?


Sources:

<struts-config>

  <form-beans>

    <form-bean 
          name="cashFlowForm"
          dynamic="true"
          type="org.apache.struts.action.DynaActionForm">
          <form-property name="flowType" type="java.lang.String"/>
          <form-property name="flowDescription" type="java.lang.String"/>
          <form-property name="flowValue" type="java.lang.String"/>                    
    </form-bean>

  </form-beans>

  <action-mappings>
  
  <action
    path="/addCashFlow"
    type="eletrosom.cashmanager.action.AddCashFlowAction"
    scope="request"
    name="cashFlowForm"
    validate="false">
    <forward name="Success" path="/addCashFlowSuccessfully.jsp" redirect="true"/>
    <forward name="Failure" path="/cashmanager.jsp" redirect="true"/>
  </action> 
  
  </action-mappings>
   
</struts-config>

--------------
public class AddCashFlowAction extends Action
{

 public ActionForward execute(
  ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws Exception
 {
  ActionForward forward = null;

  String cashFlowType = (String)((DynaActionForm)form).get("flowType");
  String cashFlowDesc = (String)((DynaActionForm)form).get("flowDescription");
  String cashFlowValue = (String)((DynaActionForm)form).get("flowValue");
  
  forward = mapping.findForward("Success");
  return forward;
 }

}

--------
addCashFlowSuccessfully.jsp

<td><bean:write name="cashFlowForm" property="flowType"/></td>
<td><bean:write name="cashFlowForm" property="flowDescription"/></td>
<td><bean:write name="cashFlowForm" property="flowValue"/></td>


Regards,

Norival




Reply via email to