Sorry! Doesn't work.

Since in the execute you hava an actionForm, instance of an DynaForm why create a new one?

When I look into yur sugestion I thougth that getFormBean("... was the solution, but nevetheless I don know how it passes to outsideof the execute.

my satus: Still need help

Thanks any way.

[EMAIL PROTECTED] wrote:

Use code like this to create an instance of the DynaFormBean:

Guy

DynaActionForm accountAdjustmentForm = (DynaActionForm) form;
ConfigHelper configHelper = new
ConfigHelper(getServlet().getServletContext(), request, response);
DynaActionFormClass formClass =
DynaActionFormClass.createDynaActionFormClass(configHelper.getFormBean("acco
untAdjustmentForm"));
if (accountAdjustmentForm == null) {
accountAdjustmentForm = (DynaActionForm) formClass.newInstance();
accountAdjustmentForm.initialize(mapping);
}


-----Original Message-----
From: "Jos� Fortunato H. Tom�s" [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 24, 2003 8:50 AM
To: Struts Users Mailing List
Subject: Pre-Setting DynaValidatorForm attributes


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(BasicDyna
ValidatorForm.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:2
10)
...
----
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to