aspose file tools*
The moose likes Struts and the fly likes Still not working - DynaValidatorActionForm and checkboxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Still not working - DynaValidatorActionForm and checkboxes" Watch "Still not working - DynaValidatorActionForm and checkboxes" New topic
Author

Still not working - DynaValidatorActionForm and checkboxes

Juarez Alvares Barbosa Junior
Ranch Hand

Joined: Mar 18, 2002
Posts: 80
I have declared a form using a subclass of DynaValidatorForm. My subclass overrides the reset() method and does the following:
getMap().put("language", "N");
This property is bound to a checkbox, its type is String and the form scope is session. I have provided an initial value of "N" to this same prop
when declaring it in struts-config.xml
Initially this checkbox is selected (value attribute in html:checkbox equals to "S").
When I unselect it and hit submit the checkboxes are displayed selected again.

I can't figure out what is wrong, please could anyone help ?
Thanks,
Juarez
Juarez Alvares Barbosa Junior
Ranch Hand

Joined: Mar 18, 2002
Posts: 80
Ooops, another important info: We are using Tiles as well...
Looking forward to some help from you folks...
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Can you post the following?
1. The definition of the DynaValidatorActionForm as it appears in the struts-config.xml file?
2. The definition of the action initially used to populate the form as it appears in the struts-config.xml file?
3. The definition of the action to which the form is submitted as it appears in the struts-config.xml file?
4. The definition of your opening <html:form /> tag as it appears in your JSP?
5. The Action method you use to populate the DynaValidator form?
Thanks,
Darryl
Juarez Alvares Barbosa Junior
Ranch Hand

Joined: Mar 18, 2002
Posts: 80
1. The definition of the DynaValidatorActionForm as it appears in the struts-config.xml file?
<form-bean name="tipocursoForm" dynamic="true" type="com.powerlogic.jcompany.comuns.CustomDynaValidatorActionForm">
<form-property name="itensPlc" type="java.util.ArrayList"/>
<form-property name="modoPlc" type="java.lang.String"/>
<form-property name="linhaPlc" type="java.lang.String"/>
<form-property name="id" type="java.lang.String" size="8" />
<form-property name="nome" type="java.lang.String" size="8"/>
<form-property name="idioma" type="java.lang.String" initial="N"/>
</form-bean>

2. The definition of the action initially used to populate the form as it appears in the struts-config.xml file?
<action path="/tipocurso" name="tipocursoForm" type="com.powerlogic.jcompany.controle.PlcBaseAction"
className="com.powerlogic.jcompany.controle.PlcActionMapping" validate="false"
parameter="evento" input="def.tipocurso">
<set-property property="logicaPlc" value="tabular#validacao"></set-property>
<set-property property="numNovos" value="7"></set-property>
<set-property property="valueObject" value="com.empresa.app.vo.TipoCurso"></set-property>
<set-property property="naoDeveExistir" value="obj.nome=:nome and obj.idioma=:idioma"></set-property>
<set-property property="urlAjuda" value="/doc/tabelabasica/tiponorma_viewlet_swf.html"></set-property>
<forward name="mesmaPagina" path="def.tipocurso"/>
</action>

3. The definition of the action to which the form is submitted as it appears in the struts-config.xml file?
The same as above.
4. The definition of your opening <html:form /> tag as it appears in your JSP?
The jsp that contains the checkbox is a region.
5. The Action method you use to populate the DynaValidator form?
I am not sure about this last one. May you clear things ?
Thanks for helping,
Juarez
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
>> 3. The definition of the action to which the
>> form is submitted as it appears in the
>> struts-config.xml file?
>The same as above.
I think the problem is in the Action class method used to process this form though I can't say without seeing it. When I want to display a pre-populated form, I go through an intermediate pre-populate step which populates the form bean before forwarding it onto another action which renders its contents on screen using the pre-populated form values. Since this action is used to pre-populated as well as process the form values, I am wondering how it handles these steps. My concern could very well be rooted in my own non-understanding of the bigger programming context your working in.

>> 4. The definition of your opening
>> <html:form /> tag as it appears in your JSP?
> The jsp that contains the checkbox is a region.
I am not sure what you mean here. I am assuming you use an <html:form> tag to specify the name of the action form you're working with as well as to specify the action you'll be POSTing or GETting to. Is this not so?

>> 5. The Action method you use to populate the
>> DynaValidator form?
> I am not sure about this last one. May you
> clear things ?
Here is an example of a dispatch method I use to pre-populate a DynaActionForm bean in one of my apps. It pre-populates the form with data before control is dispatched to another action that renders its contents on screen (NB: Actually, it is a series of two methods):



Darryl
[ March 26, 2003: Message edited by: Darryl A. J. Staflund ]
Juarez Alvares Barbosa Junior
Ranch Hand

Joined: Mar 18, 2002
Posts: 80
Ok Darryl, I think you caught the error, I have to separate the population and display tasks.
I will test right away, thks again !!!
Juarez
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Still not working - DynaValidatorActionForm and checkboxes