Java – spring MVC: Form: RadioButton of Boolean attribute

I just want to know how to use Boolean values in spring MVC forms

I try to use this Code:

My jsp:

<form:radiobutton path="dateInterval" value="false" cssClass="radio"/>
<form:radiobutton path="dateInterval" value="true" cssClass="radio"/>

POJO's property:

private Boolean dateInterval = false;

But my dateinterval attribute is always empty!

Solution

I asked them to work on my form as follows:

<form:radiobutton path="someProperty" value="true"/>
    <spring:message code="label.roundYes"/>
<form:radiobutton path="someProperty" value="false"/>
    <spring:message code="label.roundNo"/>

In my model object, someproperty looks like this:

private boolean someProperty = false;

That worked well. I didn't try 'Boolean' Maybe just test it with Boolean values to see if it helps

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>