h:selectOneRadio在一行中呈现所有选择项,如何在换行中呈现每个项? [英] h:selectOneRadio renders all select items in one line, how to render each in new line?

查看:189
本文介绍了h:selectOneRadio在一行中呈现所有选择项,如何在换行中呈现每个项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个selectOneRadio标记,所有单选按钮选项都显示在一行上.如何使每行/每行一个选项?

I have a selectOneRadio tag and all radio button options are displayed on one row. How can I make it one option per row/line?

推荐答案

要了解标签的行为及其所有可用属性, <h:selectOneRadio>标记文档:

To learn about tag's behavior and all of its available attributes, a good starting point is the tag documentation. Here's an extract relevance from the <h:selectOneRadio> tag documentation:

[...]

[...]

呈现一个表"元素.如果指定了"styleClass",则将"styleClass"属性的值呈现为"table"元素上的"class"属性的值.如果指定了样式",边框"属性,则将它们传递并在表"上将其值分别呈现为样式"和边框"属性. 如果指定了"layout"属性,并且其值为"pageDirection",则在表格中垂直(而不是水平)呈现子元素.如果任何子级是SelectItemGroup的实例,则将它们呈现为嵌套表.最终,每个孩子的渲染如下.为每个子组件呈现类型"无线电"的输入"元素.使用组件的clientId的值呈现输入"元素上的名称"属性.在输入"元素上呈现"id"属性.每个"id"值都必须是唯一的.如果当前的SelectItem.isDisabled()返回true,则将"disabled"呈现为"disabled"属性的值.

Render a "table" element. If the "styleClass" is specified, render the value of the "styleClass" attribute as the value of the "class" attribute on the "table" element. If the "style", "border" attributes are specified, pass them thru and render their values as the "style" and "border" attributes on the "table", respectively. If the "layout" attribute is specified, and its value is "pageDirection", render the children elements vertically, otherwise horizontally, in the table. If any of the children are an instance of SelectItemGroup, render them as a nested table. Each of the children are ultimately rendered as follows. Render an "input" element of "type" "radio" for each child component. Render the "name" attribute on the "input" element with the value of the clientId of the component. Render an "id" attribute on the "input" element. Each "id" value must be unique. If the current SelectItem.isDisabled() returns true, render "disabled" as the value of the "disabled" attribute.

[...]

请注意重点.有你的答案.

Note the emphasis. There's your answer.

<h:selectOneRadio ... layout="pageDirection">

这篇关于h:selectOneRadio在一行中呈现所有选择项,如何在换行中呈现每个项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆