有条件取决于存在渲染faces消息
问题描述:
我有我的表中的错误特殊行:有条件取决于存在渲染faces消息
<tr>
<td colspan="2"><p:message for="questionId" id="msgQuestion" /></td>
</tr>
如何设置此所以当有一个错误的行仅显示?
在第一个地方,我会建议not to use table to display layout elements
后,该ellement将apear即使消息是不存在的,如果你不得不使用它,你可以在JS使用SOM这样想:
<script type="text/javascript">
window.onload = function() {
hideTdMessage();
};
hideTdMessage(){
var message = document.getElementById(msgQuestion);
if(message){
//the msg is present
}else{
//the msg is not present
}}
</script>
或者你可以使用你的MBean来改变CSS类,比使用JS更好。
但我会说最好的解决方案不是使用tabel。
希望它帮助
答
在第一个地方,我会建议not to use table to display layout elements
后,该ellement将apear即使消息是不存在的,如果你不得不使用它,你可以在JS使用SOM这样想:
<script type="text/javascript">
window.onload = function() {
hideTdMessage();
};
hideTdMessage(){
var message = document.getElementById(msgQuestion);
if(message){
//the msg is present
}else{
//the msg is not present
}}
</script>
或者你可以使用你的MBean来改变CSS类,比使用JS更好。
但我会说最好的解决方案不是使用tabel。
希望它帮助
这是一个普通的HTML表,特此,它既不是一个标准的JSF组分(如''),也不是PrimeFaces组分(如'')? –
Tiny
是它的普通html –
如果表内的行是静态的(因此,'
'在里面。 – Tiny
回答
在第一个地方,我会建议not to use table to display layout elements
后,该ellement将apear即使消息是不存在的,如果你不得不使用它,你可以在JS使用SOM这样想:
或者你可以使用你的MBean来改变CSS类,比使用JS更好。
但我会说最好的解决方案不是使用tabel。
希望它帮助
相关问题