Hi users,
I'm trying to do file upload functionality kind of similar to gmail one.
I thought that it could be done using iframe and saveState from tomahawk
but I'm facing some problems.
In my page main page I have nested iframe component:
...
<h:form>
.. some input fields etc.
<div id="attachments">
<iframe src="attachments.html" frameborder="0" scrolling="no"
width="90%" height="60" ></iframe>
</div>
<h:commandLink action="#{someMBean.save} value="save" />
</h:form>
...
page nested in the iframe:
...
<t:saveState id="uploadedFiles" value="#{someBean.uploadedAttachements}"/>
...some data table to display uploaded files
<h:form enctype="multipart/form-data">
<h:panelGrid columns="2">
<t:inputFileUpload value="#{someMBean.attachment}"
storage="file" accept="*/*" required="true" size="30"/>
<h:commandButton value="upload" action="#{
someMBean.uploadAttachement}"/>
</h:panelGrid>
</h:form>
....
Now the issue is that when I upload the files, with the iframe nested page,
they are stored between request with "saveState" tag as they should,
I can see them listed in the data table.
The problem is that when I try to save the whole item (some input fields and
uploaded attachment files), with previously uploaded attachments,
using the form in my main page (the one in which iframe is nested) the
uploaded attachments collection is empty.
Placing <t:saveState id="uploadedFiles" value="#{
someBean.uploadedAttachements}"/> in the main page doesn't change situation.
Is there a way to keep state of some variable between requests generated
from iframe and my main page?
Maybe I'm following wrong way to do this upload, do you have any other
proposals?
Please note that I don't want to store anything in session scope.
Thanks in advance.
Piotr