Be aware that t:saveState also does no "magic" to not use memory for
things you store there. Generally you
have 2 types of state saving in JSF: server-side and client-side.
server-side saves the state in the HTTP Session
of the user, client-side serializes and encodes the state and sends it
back to the client in an hidden input field.

For a list of uploaded file data I would NOT recommend client side
state saving because it would always sent the
complete list of files to the client and back again (lots of bandwith
and cpu power required). If you have that much memory concerns
on your server that you cannot use the HTTP Session to store the
uploaded files temporarily then do not use t:saveState
for the file data (because it likely does exactly that - check your web.xml).

In this case you maybe want to save the files directly to disk in a
temporary folder and store only
the file-names and size in the backing bean (to still be able to show
the list of attachments before they are saved).
A nightly cron job could delete all files in the temporary folder
which are older than a day or so.

hope this helps

Ernst

On Fri, Mar 28, 2008 at 12:15 PM, Piotr <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>  any suggestions please. I'm really facing a big problem with this.
>
>
>  I thought that maybe while being in the "mainPage" view
>  I could try to retrieve value of "t:saveState" component from "iframe" view
>  but can't figure out how to implement this exactly.
>
>  Any help would be appreciated.
>
>
>
>
>
>  Piotr wrote:
>  >
>  > 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
>  >
>  >
>
>  --
>  View this message in context: 
> http://www.nabble.com/iframe-and-saveState-tp15981711p16349005.html
>
>
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Reply via email to