• 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

html:checkbox not mapping with form properties

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have used scope as session in struts-config.xml for my action(Struts 1.3).In jsp page i am having some checkboxes which are mapped to forms' some boolean properties.first time when i request that jsp page,i am getting false as all checkbox values .
After checking any checkbox if i submit that form that time i am getting correct values means true.but when i again uncheck that checkboxes,after submiting i am getting old values i.e. true.

Please HELP me.....
 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. Can you post the code from your form and from your ActionForm?
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
also tell if your pages are being cached
 
Pravin Sharma
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No we are avoiding the caching of pages...
here is my code for jsp
<html:form action="AllocationPlanAction">
<table border="0">
<tr id="order" >
<td >
<table border="0">
<tr>
<td class="form">
Start Date
</td>
<td >
<html:text name="allocationPlanForm"
property="planStartDate" styleClass="form" tabindex="-1"
maxlength="25" size="14" readonly="true" />
<input type="image"
src="images\calender_icon.gif" id="imgPlanStartDate"
tabindex="1" width="18" height="16" />

</td>
<td class="form">
Bucket Size
</td>
<td >
<html:text styleClass="form" name="allocationPlanForm"
property="planBucketSize" />
</td>
<td class="form">
<html:checkbox name="allocationPlanForm"
property="allowProjection"/>
Allow Projection
</td>
<td class="form">
<html:checkbox name="allocationPlanForm" property="allMaterialSelected">
All Material
</html:checkbox>
</td>
</tr>
<tr>
<td class="form">
End Date
</td>
<td>
<html:text name="allocationPlanForm" property="planEndDate"
styleClass="form" tabindex="2" maxlength="25" size="14"
readonly="true" />
<input type="image"
src="images\calender_icon.gif" id="imgPlanEndDate"
tabindex="1" width="18" height="16" />

</td>
<td class="form">
<html:checkbox name="allocationPlanForm"
property="inventory" />
Inventory
</td>
<td class="form">
<html:checkbox name="allocationPlanForm" property="freeWIP" />
Free WIP
</td>
<td class="form">
<html:checkbox name="allocationPlanForm" property="freeFG" value="0" />
Free FG
</td>
<td class="form">
<html:checkbox name="allocationPlanForm"
property="allOrderSelected" />
All Order
</td>
</tr>
</table>
</td>
</tr>
</table>
</html:form>



also the form code is:

public class AllocationPlanForm extends ActionForm {
/**
*
*/
private static final long serialVersionUID = 1L;
private String planStartDate;
private String planEndDate;
private String planBucketSize;
private boolean allowProjection;
private boolean inventory;
private boolean freeWIP;
private boolean freeFG;
private boolean allMaterialSelected;
private boolean allOrderSelected;
private String isAllMatSelected;

public String getIsAllMatSelected() {
return isAllMatSelected;
}

public void setIsAllMatSelected(String isAllMatSelected) {
this.isAllMatSelected = isAllMatSelected;
}

public AllocationPlanForm(){
// set the current date to planStartDate by default.
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
java.util.Date date = new java.util.Date();
planStartDate = dateFormat.format(date);
// set the end date to one month after start date by default.
Calendar c1 = Calendar.getInstance();
c1.add(Calendar.DATE, 30);
planEndDate = dateFormat.format(c1.getTime());

planBucketSize = "";
}

public String getPlanStartDate() {
return planStartDate;
}
public void setPlanStartDate(String planStartDate) {
this.planStartDate = planStartDate;
}
public String getPlanEndDate() {
return planEndDate;
}
public void setPlanEndDate(String planEndDate) {
this.planEndDate = planEndDate;
}
public String getPlanBucketSize() {
return planBucketSize;
}
public void setPlanBucketSize(String planBucketSize) {
this.planBucketSize = planBucketSize;
}
public boolean isAllowProjection() {
return allowProjection;
}
public void setAllowProjection(boolean allowProjection) {
this.allowProjection = allowProjection;
}
public boolean isInventory() {
return inventory;
}
public void setInventory(boolean inventory) {
this.inventory = inventory;
}
public boolean isFreeWIP() {
return freeWIP;
}
public void setFreeWIP(boolean freeWIP) {
this.freeWIP = freeWIP;
}
public boolean isFreeFG() {
return freeFG;
}
public void setFreeFG(boolean freeFG) {
this.freeFG = freeFG;
}
public boolean isAllMaterialSelected() {
return allMaterialSelected;
}
public void setAllMaterialSelected(boolean allMaterialSelected) {
this.allMaterialSelected = allMaterialSelected;
}
public boolean isAllOrderSelected() {
return allOrderSelected;
}
public void setAllOrderSelected(boolean allOrderSelected) {
this.allOrderSelected = allOrderSelected;
}


}


i checked one parameter with string property but that time also its not updating.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags

Pravin Sharma wrote:I have used scope as session in struts-config.xml for my action(Struts 1.3).In jsp page i am having some checkboxes which are mapped to forms' some boolean properties.first time when i request that jsp page,i am getting false as all checkbox values .
After checking any checkbox if i submit that form that time i am getting correct values means true.but when i again uncheck that checkboxes,after submiting i am getting old values i.e. true.


This problem occurred when you set the form in session scope and not override reset() method, more details here:

ActionForm.html#reset()
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic