spring MVC:form:radiobutton for Boolean property [英] spring MVC : form : radiobutton for Boolean property
本文介绍了spring MVC:form:radiobutton for Boolean property的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想知道如何在Spring mvc表单中使用布尔值。
I just want to know how to use a Boolean in a Spring mvc form.
我尝试使用此代码:
我的jsp:
<form:radiobutton path="dateInterval" value="false" cssClass="radio"/>
<form:radiobutton path="dateInterval" value="true" cssClass="radio"/>
pojo上的财产:
private Boolean dateInterval = false;
但我的dateInterval属性始终为null!
But my dateInterval property is always null!
推荐答案
我让他们在我的表格上工作如下:
I have them working on my form like this:
<form:radiobutton path="someProperty" value="true"/>
<spring:message code="label.roundYes"/>
<form:radiobutton path="someProperty" value="false"/>
<spring:message code="label.roundNo"/>
在我的模型对象中,someProperty看起来像这样:
and in my model object the someProperty looks like this:
private boolean someProperty = false;
工作正常。我还没有尝试过'布尔'。也许只是尝试使用布尔值,看看它是否有帮助。
That works fine. I haven't tried it with 'Boolean'. Maybe just try it with boolean and see if it helps.
这篇关于spring MVC:form:radiobutton for Boolean property的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文