You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Chitta Ranjan Mishra <c_...@yahoo.co.in> on 2004/05/05 11:34:28 UTC

Struts help

Dear Sir,
   Presently I am working on Struts project...
   I am struggling with one problem since last 2 days
regding html:checkbox in Struts.

My problem is while inserting data into the database
thru a checkbox field... either check or uncheck the
checkbox proper value is inserted into the table.
Now in case of Updating the same field, suppose then
check box was UNCHECKED earlier and if I CHECK it and
try to update it ...it's also working fine.
But the problem occurs :  when the check box was
CHECKED earlier and I try UNCHECK it update it ...it's
not working. After submitting the request , the value
it's taking as the checked value(i.e. in my case if
the checkbox is checked then 'Y' should be inserted
and if the checkbox is unchecked then 'N' should be
inserted) i.e 'Y'.

I read from the net that ...if a unchecked checkbox is
submitted then the value passed is null ....so i
should check in my action class that if it is null,
then i should explicitely set it to 'N'.
But in my case 'null' is not passed ...the previous
value 'Y' is passed .
So I reques you kindly pl ...help me what to do .
In my jsp page I am doing like this :
<html:checkbox name="saListStockUpdateResult"
property="dirtAsMetalInd" styleClass="edit" value="Y"
indexed="true" />

Here saListStockUpdateResult is a list which contains
many values .
Now if u say that in the <html:checkbox tag, I should
not give like : 
value="Y"  ....even that also i have tried....but the
result is same....from the request it's taking the
previously stored value.....
Even I have used the reset() also in my Action class.
But the result was same.

So plz help me what to do.It's very urgent...
Thanking you,
Regds
C.R.Mishra






________________________________________________________________________
Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/

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