• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Still not working - DynaValidatorActionForm and checkboxes

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ooops, another important info: We are using Tiles as well...
Looking forward to some help from you folks...
 
Ranch Hand
Posts: 314
2
Android VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 314
2
Android VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>> 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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic