views:

124

answers:

2

I am getting this warning in my jsf application when I upload an image through rich:fileUpload.

<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"&gt;
    <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>

Many thanks in advance!

EDIT: Actually the exact error I am getting is:

Jul 26, 2010 6:30:13 PM org.ajax4jsf.context.AjaxContextImpl convertId

WARNING: Target component for id thumbnailSelector not found

A: 

You are probably rerendering a component that's not found in the view.

Max Katz
Yes but why isn't it found? Maybe the 'immediate' attribute has something to do with it? Thanks for you reply!
Panayiotis Karabassis
No, the immediate attribute doesn't play a role here. It can't find the component during rendering. Make sure the component is present in the tree during rendering.
Max Katz
Changing the f:verbatim to f:subview worked! I guess I still have much to learn about jsf.
Panayiotis Karabassis
A: 

Try to add in the form tag:

<form prependId="false" >
Odelya
No, same thing. But thanks for your reply!
Panayiotis Karabassis