• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CheckBok not storing Values

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI all,

I have few Checkboxes,

<html:checkbox name="chk_CMA"value="on">
and
in my bean i have
public boolean chk_CMA;

public boolean isChk_CMA() {
return chk_CMA;
}

public void setChk_CMA(boolean b) {
chk_CMA = b;
}
and in my database insert query i check if it is checked then insert the value, It is inserting the value. and when the page is returnback, all the check box values are lost (checked ones becomes vanished).
Kindly help in solving the issue. i would like to retain the checked ones
Thanks
Rudresh
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Definately you have defined action and action form for this in your applicaiton.

But when you load the page first time, the values are papulated from database but how the ActionForm will come to know what are the values.

So set the values while using the setter method in execute method of your action when you fetch data from database.

This will resolve the problem and data will be displayed to html page properly.

...execute(request,respone,form....){

if(valueindb){
{
form.setCheckBox(true)
}else{
form.setChckBox(false)
}

remember the form instance should be the same which is passed to execute method of action.
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic