0

I'm using JBoss 7.1.1.Final, Seam 3.1, CDI, JSF 2, Primefaces 3.4RC1. I have a page that has following s:viewAction:

<f:metadata>
            <f:viewParam name="entryId" value="#{selectedEntry}" />
            <s:viewAction
                action="#{entryActionManager.selectEntryById(selectedEntry)}" />
</f:metadata>

The entryActionManager is @ViewScoped so when the page is loaded the entryId GET parameter is retrieved and and corresponding entry is loaded in this @ViewScoped bean.

Further, I have following fileUpload component on the same page:

<h:form id="uploadForm" enctype="multipart/form-data">
            <p:fileUpload update=":files:filesTable"
                fileUploadListener="#{bean.uploadFile}" 
                mode="advanced" sizeLimit="2000000" >
            </p:fileUpload>         
    </h:form>

It turns out that if I want to upload the file, the @ViewScoped bean will die and s:viewAction is being executed again. However, from some reason it doesn't have the GET parameter (entryId) anymore and therefore it fails.

I tried to set:

<context-param>
    <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
    <param-value>false</param-value>
</context-param>

But it doesn't work. Do you know about any workaround for this? One option would be to use @ConversationScoped but I would prefer to use @ViewScoped

thanks

lukas
  • 545
  • 2
  • 7
  • 18
  • You could try uploading files via ajax. This way the view scoped bean doesn't die (the page doesn't get reloaded). – siebz0r Aug 25 '12 at 09:18
  • but how can I do that? p:fileUpload component doesn't have ajax option – lukas Aug 26 '12 at 20:40

0 Answers0