JSF 2.0 F:AJAX渲染ID未找到 [英] jsf 2.0 f:ajax render ID not found

查看:280
本文介绍了JSF 2.0 F:AJAX渲染ID未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在弹出(PP1)保存按钮点击列表获取更新的项目。 但是,当preSS的项目列表中的更新按钮,渲染ID:Form1中:PP1是不是有错误时它正在呈现来临。如果不渲染=@所有它的工作原理,但它并不好。 (错误:< F:AJAX> 包含未知的ID:窗口1:PP1')

 < H:表格ID =Form1的prependid =假>
< H:panelGroup中的id =项目>
< UI:重复VAR =行动值=#{dadadada}varStatus =状态>
< H:的commandButton值=保存>
//给ID未找到错误
< F:Ajax事件=点击执行=@形式呈现=:窗口1:PP1监听器=#{fsfsfsfsfs}/>
< / H:的commandButton>
< / UI:重复>

< /小时:panelGroup中> //项目面板组

//弹出
< H:panelGroup中的id =PP1>
< D​​IV ID =popup2级=popup_block>

//保存按钮,在弹出的
< D​​IV CLASS =popupBody_save2>
            < H:的commandButton形象=资源/图像/ saveBtn.gif值=保存>
             < F:Ajax事件=点击执行=@形式呈现=项目监听器=#{dfsfssfs}/>
            < / H:的commandButton>
        < / DIV>

< / DIV>
< /小时:panelGroup中>

< /小时:形式GT;
 

解决方案

:Form1中:PP1 将无法正常工作,因为你有 prependId =假的形式。该 PP1 将无法工作,因为它再寻找在同一个范围内组件作为< UI:重复> 这是由它本身的 UINamingContainer 部分。

在打开网页浏览器,单击鼠标右键JSF页面和的查看源文件的获取生成的HTML。找到它是由&LT生成的HTML元素; H:panelGroup中的id =PP1> 。它应该是这个样子。

 <跨度ID =富:巴:PP1>
 

您需要使用完全 pfixed与这个ID $ P $:渲染属性。

 < F:AJAX渲染=:FOO:巴:PP1>
 

如果有一个自动生成的ID部分,如 j_id0 ,那么你需要给有问题的父组件的固定ID。

When the Save button in the popup(pp1) clicked the projects list gets updated. But when press the update button in the projects list, the render ID :form1:pp1 is not there error comes when its being rendered. If do render="@all" it works, but its not good. ( error : <f:ajax> contains an unknown id ':form1:pp1')

<h:form id="form1" prependid=false>
<h:panelGroup id="projects">
<ui:repeat var="action" value="#{dadadada}" varStatus="status">
<h:commandButton value="Save">
//gives id not found error
<f:ajax event="click" execute="@form" render=":form1:pp1" listener="#{fsfsfsfsfs}" />
</h:commandButton>
</ui:repeat>

</h:panelGroup> // project panel group

//popup
<h:panelGroup id="pp1">
<div id="popup2" class="popup_block">

//save button in the popup
<div class="popupBody_save2">
            <h:commandButton  image="resources/images/saveBtn.gif" value="Save">
             <f:ajax event="click" execute="@form" render="projects" listener="#{dfsfssfs}" />
            </h:commandButton>
        </div>

</div>
</h:panelGroup>

</h:form>

解决方案

The :form1:pp1 won't work since you have prependId="false" on the form. The pp1 won't work since it's then looking for the component in the same scope as <ui:repeat> which is by itself an UINamingContainer component.

Open the JSF page in webbrowser, rightclick and View Source to get the generated HTML. Locate the HTML element which is generated by <h:panelGroup id="pp1">. It should look something like this

<span id="foo:bar:pp1">

You need to use exactly this ID prefixed with : in the render attribute.

<f:ajax render=":foo:bar:pp1">

If there's an autogenerated ID part such as j_id0, then you need to give the parent component in question an fixed ID.

这篇关于JSF 2.0 F:AJAX渲染ID未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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