You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brandon Goodin <ma...@phase.ws> on 2002/10/01 17:47:46 UTC

Nested Multibox (Dummy) Question

Greetings,

Here is a seemingly minor issue.. Any thoughts?

What i want is to iterate over a list of beans and produce checkboxes that
can be selected to delete records. The checkbox references the
someListBean.id property and i want the value to be the same as
someListBean.property without all the checkboxes being checked initially
(ex. final output: <input type="checkbox" name="someListBean[0].id"
value="123">). Is this possible or am I barfing up the wrong tree :-D. I was
thinking what i might have to do is to add a boolean to my beans. Something
like isSelected()/setSelected() and use the regular checkbox along with a
hidden form element of the same index with an id value equal to my record.
Then when the values are passed back to my FormBean and my nested beans auto
populated they will set the boolean as well. Then i can just check my bean
values on the back. But, I felt like this is adding web tier elements to my
model. Is there any way to handle this without cluttering my model beans
with a "selected" property?

So the goals are:
- Create checkboxes with id values
- Have dot notation referencing beans that are nested in my FormBean
- Make them initially unchecked

Reason:

Because the only beans to be populated on the back will contain the id of
the records to be deleted. Therefore i create less objects on the back and
can pass those beans to a generic auto delete function using OJB PB API. It
just makes life WAY easier for me :-D.

My code looks like the following:

<nested:form action="someAction.do" method="post">
<nested:iterate propery="someList">
<nested:multibox property="id"><nested:write property="id"
/></nested:multibox>
</nested:iterate>
</nested:form>

P.S. Struts + Nested Tags + OJB = simplicity :-D



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>