how to pass value through <s:checkbox>

hello,

plz help me with this.

i've saved my object in a session variable named list. it has name,size, componentId attributes.

i want that when user click the submit button, componentId (its of BigInteger type) values will be passed to my action class.

here is my jsp snippet for doing this.

<s:form action="deleteVideo" >

<s:iterator value="#session.list">

<s:checkbox name="componentId" fieldValue="componentId" />

<s:property value="name" />

<s:property value="size" />

</s:iterator>

<s:submit value="Delete Video"/>

</s:form>

& here is action code for setting componentId values that will be rendered from the checkboxes.

public BigInteger[] getComponentId(){

return componentId;

}

publicvoid setComponentId(BigInteger[] componentId){

this.componentId = componentId;

}

anyone plz tell me, whats wrong with my code?

[1413 byte] By [anonyma] at [2007-11-27 8:41:33]
# 1

use of checkboxlist instead of checkbox has solved my problem and created a new one :P. <s:checkboxlist> automatically generates label for each checkbox even when u don't want one.

if don't want it do the following:

1. go to struts2-core-2.*.jar/template/simple/checkboxlist.ftl

2. here u will find the line

<label for="${parameters.name?html}-${itemCount}" class="checkboxLabel">${itemValue?html}</label>

3. delete the bold part.

now use checkboxlist with simple theme :

<s:checkboxlist

theme="simple" name="yourValue"

list="yourList" />

Message was edited by:

anonym

anonyma at 2007-7-12 20:40:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...