在 Form 中为 JSF 单选按钮提供什么值?[复制]

What value to give JSF Radiobuttons in Form? [duplicate]

提问人:johndonnon 提问时间:2/5/2018 最后编辑:Ashish Mathewjohndonnon 更新时间:2/6/2018 访问量:310

问:

我的 jsf xhtml 文件中有两个表单中的单选按钮,但我不知道我应该给它们哪些值以及给我的提交按钮哪个值。两个单选按钮决定用户是否要从他的帐户中存入或取款(这是我所在班级的在线自动取款机的模拟)我有一个 Bean,其中有两种存款或取款方法,但我无法弄清楚这一点。(我是新来的,对不起)

<h:outputLabel class="form-check-label">
                <h:selectOneRadio value="#{}">
                    <f:selectItem itemValue="#{}" 
                         itemLabel="Deposit" />
                    <f:selectItem itemValue="#{}" 
                         itemLabel="Withdraw" />
                </h:selectOneRadio>
</h:outputLabel>
<button type="submit" class="btn btn-primary">Submit</button>
JSF JSF-2 XHTML格式

评论


答:

0赞 M.A.Bell 2/5/2018 #1
 <h:selectOneRadio value="#{}">
                <f:selectItem itemValue="#{}" 
                     itemLabel="Deposit" />
                <f:selectItem itemValue="#{}" 
                     itemLabel="Withdraw" />
 </h:selectOneRadio>

<h:selectOneRadio value="#{}">将变量放在要放置所选值的位置

<f:selectItem itemValue="#{}" itemLabel="Deposit" />输入单选按钮的值

请参阅此处的示例 h:Radiobutton mkyoungh:RadioButton 教程点