struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Germán Leonardo Largo Urrea <gla...@websys.com.co>
Subject DynaFormAction problem
Date Thu, 03 Oct 2002 19:28:26 GMT
  Hi everybody,

I have this action

    <!-- Editar institucion -->
    <action    path="/editarInstitucion"
               type="co.com.proveedores.EditarInstitucionAction"
          attribute="institucionForm"
              scope="request"
           validate="false">
      <forward name="success"              path="/editarInstitucion.jsp"/>
    </action>

and this form-bean...

    <!-- Institucion form bean -->
    <form-bean      name="institucionForm"
                    type="org.apache.struts.action.DynaActionForm">
       <form-property name="action" type="java.lang.String"/>
       <form-property name="id" type="java.lang.String"/>
       <form-property name="name" type="java.lang.String"/>
     </form-bean>

in EditarInstitucionAction I have this...

    if(form==null){
        DynaActionForm institucionForm = new DynaActionForm();
        PropertyUtils.setSimpleProperty(institucionForm, "action", "crear");
        PropertyUtils.setSimpleProperty(institucionForm, "codigo", "-1");
        request.setAttribute(mapping.getAttribute(),institucionForm);
    }
    return (mapping.findForward("success"));

then in editarInstitucion.jsp I have....

<logic:equal name="institucionForm" property="action"
            scope="request" value="crear">
  <title><bean:message key="editarInstitucion.titulo.crear"/></title>
</logic:equal>
<logic:equal name="institucionForm" property="action"
            scope="request" value="modificar">
  <title><bean:message key="editarInstitucion.titulo.modificar"/></title>
</logic:equal>

I get this Exception

java.lang.NullPointerException
at 
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1548)
at 
co.com.proveedores.EditarInstitucionAction.execute(EditarInstitucionAction.java:104)


If I make this changes...

        if(form==null){
            DynaActionForm institucionForm = new DynaActionForm();
            request.setAttribute(mapping.getAttribute(),institucionForm);
        }
        return (mapping.findForward("success"));

I get this Exception

javax.servlet.ServletException: Exception accessing property action for 
bean institucionForm: java.lang.NullPointerException
at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:494)
at 
org.apache.jsp.editarInstitucion_jsp._jspService(editarInstitucion_jsp.java:93)

What I'm doing wrong? Is there any other way to use DynaFormAction?

Thanks in advance,
-- 
Germán Leonardo Largo Urrea
Medellín, Colombia


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


Mime
View raw message