tags:

views:

1035

answers:

2
<display:column property="id" sortable="true" 
    paramId="id" paramProperty="id" titleKey="adminList.id"/>

<display:column property="username" sortable="true" titleKey="adminList.username"/>
<display:column property="password" sortable="true" titleKey="adminList.password"/>
<display:column>
   <s:url id="removeUrl" action="remove">
 <s:param name="id" value="37" />
 </s:url>
<s:a href="%{removeUrl}" theme="ajax" targets="adminList">Remove</s:a>

 </display:column>
</display:table>

when i will execute this code the statement

<s:param name="id" value="37" />

will be excecuted perfectly but I can't get that value in struts action class. also if i pass

<s:param name="id" value="adminList.id" />

then it will pass nothing

A: 

Is adminlist an actual object or collections (I am just looking at the name to make that assumption). Check to see the adminList is actually on the ValueStack, try printing out <s:property value="%{adminList}"/> If you do not see it you havent done the work to place it on the value stack. But assuming the actual name of the id object is id, such like int id; and that id object has the appropriate getter, public int getId(); Then it should work fine.

+1  A: 

Its hard to say exactly what is wrong but I could guess:

If you are not getting the value in the struts action then check that you have a property called id along with the gettId() and settId() methods defined in the action class. Struts will attempt to populate all the properties from the parameters by name. You are passing a parameter named id.

The second part of the problem is that you are not accessing the variable properly. Try this:

    <s:param name="id" value="#attr.adminList.id" />

assuming that adminList is the name of the object and not the name of your collection?

Vincent Ramdhanie
Thanks for your precious answer.
Aryabhatt