在支持bean字符串值中插入新行 [英] Insert new line in a backing bean string value

查看:157
本文介绍了在支持bean字符串值中插入新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用JSF 2.0框架在单词之间为支持bean值插入新行并在UI上显示它?如果我们有地址.街道名称应位于第一行,城市和州应位于第二行.我正在使用转换器添加新行.但它不会显示在用户界面上.

How to insert a new line between words for a backing bean value and display it on UI using JSF 2.0 framework? If we have address. The street name should be in first line and city and state should be in the second line. I am using a converter to add new line. But it does not show up on the UI.

推荐答案

JSF基本上是HTML代码生成器. HTML中的新行由<br />标记而不是\r\n字符或类似内容显示.您可以直接在视图中进行操作,而不必在托管Bean或转换器中混合特定于视图的详细信息.

JSF is basically a HTML code generator. A new line is in HTML to be presented by the <br /> tag, not by \r\n characters or something. You can just do it straight in the view instead of mingling view-specific details in the managed bean or a converter.

<h:outputText value="#{user.address.street} #{user.address.houseNumber}" />
<br />
<h:outputText value="#{user.address.city}, #{user.address.state}" />

这篇关于在支持bean字符串值中插入新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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