wood burning stoves 2.0*
The moose likes Struts and the fly likes Problem using html:checkbox in logic:iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem using html:checkbox in logic:iterate" Watch "Problem using html:checkbox in logic:iterate" New topic
Author

Problem using html:checkbox in logic:iterate

Philipp Moisel
Greenhorn

Joined: May 18, 2009
Posts: 4
Hi all,

i would appreciate you could help me with my problem.
I've got a page showing some infos, buttons and a table with more infos in an iframe.
the infos and buttons at the "outer" page are backed by a bean. this bean has a collection of beans for each table-row in the iframe. each row got 4 checkboxes.
my code works as follows:
the page shows some boxes checked, some not. showing the information from the bean to the html-form works. by submitting the form the boolean members in the bean backing the checkboxes are always false. i did overwrite the reset() method for clearing the values.
so everytime i submit the form the boolean values are false. i didn't manage to get a "true" by checking one of the boxes.

my code:

html-page (outer):


html-page (iframe):


the Action-Class:

logging everytime "false", i didn't manage to get one damn "true".


Please give me some advice to find and eliminate my mistake!
Thanks in advance,
Philipp
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Is there any error shown in logs file ?
Also, I want you to change the name of logic:iterate id from "rows" to "row", and re run if that make any sense. This is my guess, because the property and id attribute pointing to same thing "rows".


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Philipp Moisel
Greenhorn

Joined: May 18, 2009
Posts: 4
Sagar Rohankar wrote:Is there any error shown in logs file ?
Also, I want you to change the name of logic:iterate id from "rows" to "row", and re run if that make any sense. This is my guess, because the property and id attribute pointing to same thing "rows".


Did the suggested Change, no impact

New Codesnippets:

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Philipp Moisel wrote: i did overwrite the reset() method for clearing the values.

Post your Action Form(bean).
Philipp Moisel
Greenhorn

Joined: May 18, 2009
Posts: 4
Thanks, got the solution!

There were two Problems, one easy and one tricky:
First:
In the iframe there was a second form, i had to submit this. Bad mistake, but easy to find.

Second:
In the jsp i had to define an bean and use other name / property values for the html:checkbox


The Code that made it work:



I don't exactly know _why_ it works, but now it does.
If anyone can explain this to me i would appreciate.

Thanks alot guys, i spent too much time on this.
Cheers
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Philipp Moisel wrote:

I don't exactly know _why_ it works, but now it does.

If the above code works for you, thats means you have a 'faelleForm' with array of 'rows' attribute which contains 'inBearbeitung' attribute. Am I correct, lets check by posting your action form.
Philipp Moisel
Greenhorn

Joined: May 18, 2009
Posts: 4
I sure got such an object. but as I understood the taglibs my first try with

should generate the same output.
 
 
subject: Problem using html:checkbox in logic:iterate
 
Similar Threads
Deleting checked rows in struts.
Checking Checkbox values in indexed form
Help! Form to update multiple records upon save
how to have dynamically created checkboxes handled in action form?
Retriving values from html:checkbox in a jsp