【问题标题】:WARNING: Target component for id thumbnailSelector not found警告:未找到 id thumbnailSelector 的目标组件
【发布时间】:2011-03-20 16:42:04
【问题描述】:

当我通过rich:fileUpload 上传图像时,我在jsf 应用程序中收到此警告。

<rich:fileUpload id="file" required="true"
                 listHeight="50" immediateUpload="true" 
                 maxFilesQuanity="1"
                 uploadData="#{entryHandler.uploadItems}"
                 fileUploadListener="#{entryHandler.uploadListener}">
                 <a4j:support event="onuploadcomplete" 
                              action="#{entryHandler.store}"
                              immediate="true"
                              reRender="thumbnailSelector" />
</rich:fileUpload>

...

<my:inputThumbnailSelector
    id="thumbnailSelector"
    imageServlet="#{facesContext.externalContext.requestContextPath}/preview/get.servlet"
    selector="id" 
    selectorValue="#{entryHandler.entry.id}"
    backingBean="#{entryHandler.entry}" >
</my:inputThumbnailSelector>

inputThumbnailSelector.xhtml:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:a4j="http://richfaces.org/a4j">
    <f:verbatim id="#{id}">
        <div style="position: relative;">
            <img style="position: absolute; left: 0; top: 0;" src="#{imageServlet}?#{selector}=#{selectorValue}&amp;time=#{utility.timestamp}"/>
            <div class="thumbnail-selector"
                 style="z-index: 1; position: absolute; left: #{backingBean.thumbnailLeft}; top: #{backingBean.thumbnailTop}; border-width: 2px; width: #{utility.thumbnailDimension-4}px; height: #{utility.thumbnailDimension-4}px;"/>
        </div>
    </f:verbatim>
</ui:composition>

非常感谢!

编辑:实际上我得到的确切错误是:

2010 年 7 月 26 日下午 6:30:13 org.ajax4jsf.context.AjaxContextImpl convertId

警告:未找到 id thumbnailSelector 的目标组件

【问题讨论】:

    标签: ajax jsf richfaces file-upload


    【解决方案1】:

    尝试在表单中添加标签:

    <form prependId="false" >
    

    【讨论】:

      【解决方案2】:

      您可能正在重新渲染视图中未找到的组件。

      【讨论】:

      • 是的,但为什么找不到?也许“立即”属性与它有关?感谢您的回复!
      • 不,immediate 属性在这里不起作用。在渲染过程中找不到组件。确保组件在渲染期间存在于树中。
      • 将 f:verbatim 更改为 f:subview 有效!我想我对 jsf 的了解还有很多。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-11
      • 1970-01-01
      • 2019-04-05
      • 2014-07-04
      • 1970-01-01
      • 2017-08-25
      • 2013-06-08
      相关资源
      最近更新 更多