struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus.Malmqv...@Tietoenator.com
Subject RE: Checkboxes inside a list
Date Mon, 09 Feb 2004 14:51:27 GMT
   Hi,

According to my log printings the setter for the checkbox boolean was never
called even if there was checked checkboxes. Is this caused by the fact that
the setter for the boolean is embedded inside the list and the setter in the
actionform just sets the list? Should the actionform setter do something
else? At least now the actionform setter is not called. 

It is kind of logical actually, the framework should reach into the list and
call the correct setter for each item. Obviously a setter that sets the list
itself does not help at all. It was just that without really thinking about
it writing symmetrical getter and setter seemed logical. Now it feels quite
stupid indeed. I should have read that book further...  :-)

Well, after few trials with different setters I managed to find out that
while you can get a boolean array, it only reports the checkboxes that are
checked, and is thus useless without position info. I am almost sure that
the 'indexed' parameter of the 'html:checkbox' tag would enable position
info. However, I am unable to figure out what signature the corresponding
setter should have. I have several, and none of them is called... Is there
some document that would enlighten me, or could you please help? I would not
like to try to look it up from the sources... Another option would be to use
'multibox' tag instead, as suggested by a person.

I think the ActionForm contents are not relevant now, only the proper
signature for the setter matters. JSP itself seems to be working perfectly.
It generates HTML there checkboxes are differentiated by name, as it should
be in HTML. I could always rip the information straight from the request,
but I would rather use a setter and the form instead.

Sorry about rambling at the beginning, at least you can view my not so
impressive learning process.  :-)

  <tr>
    <td align="center">
      <input type="checkbox" name="ti[0].remove" value="on">
    </td>

  <tr>
    <td align="center">
      <input type="checkbox" name="ti[1].remove" value="on">
    </td>

  --markus


-----Original Message-----
From: Andrew Hill [mailto:andrew.david.hill@gridnode.com] 
Sent: 09 February 2004 10:59
To: Struts Users Mailing List
Subject: RE: Checkboxes inside a list

Was that for all the checkboxes - or just the ones that were not ticked?

Can you show us a snippet of the actionform and the generated html?

-----Original Message-----
From: Markus.Malmqvist@Tietoenator.com
[mailto:Markus.Malmqvist@Tietoenator.com]
Sent: Monday, 9 February 2004 16:55
To: struts-user@jakarta.apache.org
Subject: Checkboxes inside a list


   Hi,

 

Is it possible to have checkboxes inside a list? I tried this and the table
in the JSP was rendered fine and the getters of the list elements were
called correctly. However, after pressing submit the setters were not
called, and thus the checkbox values were not transmitted into the bean.

 

  --markus

 



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message