From JSP, Only the Boolean
value is not binding into action's Boolean
variable. Other all variable are getting binding fine.
xBudgetFlag
is Boolean
variable which is not binding.
Other all variables are binding.
Earlier from action to JSP also not worked, after added multiple getters for xBudgetFlag
its working fine.
@Component
@Scope(value = "request")
public class PaActions extends ActionSupport {
private static final long serialVersionUID = 1L;
.
.
.
private Long keyId;
private String taxUnit;
private Long surveyTypeId;
private String surveyType;
private Long accountId;
private String status;
private Boolean parentFlag;
private Boolean xBudgetFlag;
// all setter getter are here
// Tried with different ways of getter method thinking isxBudgetFlag() is working, but still all three getters are threre in action class
public Boolean getxBudgetFlag() {
return xBudgetFlag;
}
public Boolean isXBudgetFlag() {
return xBudgetFlag;
}
public Boolean isxBudgetFlag() {
return xBudgetFlag;
}
public void setxBudgetFlag(Boolean xBudgetFlag) {
this.xBudgetFlag = xBudgetFlag;
}
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public String save() {
.
.
.
System.out.println("----------isxBudget --"+isxBudgetFlag()); // printing null
System.out.println("---------- isXbudget --"+isXBudgetFlag()); // printing null
System.out.println("---------- GET XBUDGET --"+getxBudgetFlag()); // printing null
System.out.println("---------- xBudgetFlag --"+xBudgetFlag); // printing null
.
.
.
return SUCCESS;
}
}
in JSP pa-edit.jsp
:
<s:form id="PaActions" action="pa-submit" validate="true">
<s:token />
<s:hidden name="keyId" id="keyId"/>
.
.
.
<tr>
<td class="formLabel"><label for="xBudgetFlag">X-Budget Flag</label></td>
<td><s:checkbox property="xBudgetFlag" name="xBudgetFlag" /></td>
</tr>
.
.
.
<s:submit property="save" value="Save" id="save" />
</s:form>
struts.xml
:
<action name="pa-submit" class="/PaActions" method="save">
<result name="success" type="redirectAction">
<param name="actionName">pa-display</param>
<param name="key">${keyId}</param>
</result>
<result name="input" type="tiles">.pa.edit</result>
<result name="invalid.token" type="tiles">.pa.edit</result>
</action>
tiles.xml
:
<definition name=".pa.edit" >
<put-attribute name="title" value="Project KKK" />
<put-attribute name="body" value="/pages/pa-edit.jsp" />
<put-attribute name="parentMenu" value="pa" cascade="true" />
</definition>