struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "José Fortunato H. Tomás" <jose.to...@link.pt>
Subject Re: Pre-Setting DynaValidatorForm attributes (solution/conclusion)
Date Fri, 25 Jul 2003 12:49:57 GMT
Hi!

Just for close this post I want to say this:
- I had a bug for something stupid I made and I didn't realise what was referred 
by the exception.
The code that I presented here is the correct one. Since we are in a Action or 
JSP nested to an Action Form, a bean exists in the correct scope with the 
respective attribute name.

Thanks anyway.

José Fortunato H. Tomás wrote:

> Hi!
> 
> I have the follow situation:
>  - I get an Circuit Data Object from a manager
>    Then I want to edit the Circuit in HTML form, using an 
> DynaValidatorForm I don't know to how to do correct set for the 
> propertyes priorly!
> 
> How should I set the properties priorly?
> 
> I'm tring to do the usual set(key, object), but I get an 
> NullPointerException on getter:
> ----
> java.lang.NullPointerException
>         at 
> org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:596) 
> 
>         at 
> org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:241)
>         at 
> com.esegur.sims.util.struts.form.BasicDynaValidatorForm.getInteger(BasicDynaValidatorForm.java:32)

> 
>         at 
> org.apache.jsp.circuitEditForm_jsp._jspService(circuitEditForm_jsp.java:145) 
> 
>         at 
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210) 
> 
> ...
> ----
> BasicDynaValidatorForm is just an helper for getString, getInteger and 
> so on.
> 
> The code I'm using for setting is:
> ---
>         if (actionForm instanceof BasicDynaValidatorForm ) {
>             BasicDynaValidatorForm circuitEditForm = 
> (BasicDynaValidatorForm)actionForm;
> 
>             circuitEditForm.initialize(actionMapping);
> 
>             CircuitDO cDO = 
> Planning.getCircuitSessionAttr(httpServletRequest);
>             circuitEditForm.set( "circuitId", cDO.getCircuitId() );
> /*...*/
>             circuitEditForm.set( "designation", cDO.getDesignation() );
>         }
> ---
> 
> Thanks

-- 
José Tomás
  LINK Consulting SA - http://www.link.pt
  Av. Duque de Avila 23 5º Dto. - 1000-138 Lisboa
  Telf: (+351) 213 100 095  Fax: (+351) 213 100 079



---------------------------------------------------------------------
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