Hello sorry for posting the same question again and again. But I seem to
have gained something on this. Now I have a few (more) questions. Maybe
someone could help me figure out what or where I am getting it wrong.
This is the case. I have a product, with different states(checbox) and
each state has to have a bidAmount (text area) and a transaction
type(radio button). I want the form to be generated such that for
validation.
a. I can check If the checkbox(for the state) has been checked the
bidAmount and transaction type has been selected.
Now my question is,
a. in the action form. Do I need to defind the bidAmount as an array
b. I didn't know about this until know, but are only String type allowed
in actionform ( ihavent read about this anywhere except on one of the
posts in this mailing list)
c. I have set the setter and getter for (lets take the example of
bidAmount only) like this.
public String getBidAmount(int index) {
String tmp = new String();
System.err.println("Value of index: " + index);
try {
tmp = bidAmount[index];
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
}
return tmp;
}
public void setBidAmount(int index, String value) {
System.err.println("index: " + index);
System.err.println("Value: " + value);
System.err.println("------------------");
this.bidAmount[index] = value;
}
And the corresponding jsp tags as follows.
<logic:iterate id="state" name="STATES" indexId="currIdx">
<tr bgcolor="#F8F8F8">
<td align="left" valign="top">
<html:multibox property="stateId" styleClass="flat">
<bean:write name="state" property="id" />
</html:multibox> <bean:write name="state" property="name" />
</td>
<td >
<html:text name="bidForm"
property='<%="bidAmount["+currIdx+"]"%>' styleClass="flat" size="3" />
</td>
<td align="center">
BC <html:radio name="bidForm" property="mode" value="2"
titleKey="app.bcall" indexed="true" styleClass="flat" />
| SC <html:radio name="bidForm" property="mode" value="1"
titleKey="app.scall" indexed="true" styleClass="flat" />
</td>
<td align="right">
<bean:write name="state" property="buyingCall" ignore="true"
/>
</td>
<td align="right">
<bean:write name="state" property="sellingCall"
ignore="true" />
</td>
</tr>
</logic:iterate>
I know the the inline scriptlet is very ugly, but this was the only way
I could get it to call the index number in the getter method. However
the desperate attempt (try and catch) makes the form work (not much use)
I cant get the the setter to set the values in the individual array, and
get a stack trace error instead.
I am not really sure where Is wrong and non or the documentataion define
things very clearly (or maybe I am poor in comprehension)
Apologies again to people who think I am bothering them by posting again
and again, but this is my last hope!!
Hope someone helps!
(ps: once I am through with this, I shall write my own HOW TO for the
indexed properties and its use)
Rajat Pandit | [EMAIL PROTECTED]
+91 612 3117606
[ Developer and Part Time Human Being]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]