I am using the fileUpload feature of PrimeFaces 4.0 to upload a .css file. The application then needs to load all of the stylesheet classes in the file. The application then should render a selectOneMenu
with the classes, one of which the user will choose, which will then apply to another element.
The problem is that I could not find a way to update the selectOneMenu
after having uploaded a file. I have the file upload even longer as loading the elements from selectOneMenu
ManageBean.
Here is upload.xhtml
:
<h:form id="Edit" enctype="multipart/form-data">
<p:fileUpload fileUploadListener="#{sintaxisWizard.handleFileUpload}"
mode="advanced"
update="growl productCode"
label="Escoge archivo css"
auto="true"
sizeLimit="10485760"
allowTypes="/(\.|\/)(css)$/"
invalidSizeMessage="El maximo tamaño del archivo es 10 Megabytes !"
invalidFileMessage="Unicamente se puede subir archivos css" />
</h:form>
And my selectOneMenu
<p:selectOneMenu id="combo" value="#{sintaxisWizard.animalSelected}">
<f:selectItem itemLabel="Select..." noSelectionOption="true"/>
<f:selectItems value="#{sintaxisWizard.allAnimals}" />
</p:selectOneMenu>
Si necesitas una traducción al español, y te lo proveeré.
You will need to set the
update
component of yourp:fileUpload
to actually update the correct component. Right now, it is set to updategrowl
andproductCode
, but notcombo
, the ID of yourp:selectOneMenu
.None of this deals with the problems you will face in dynamically loading a new CSS page for the user, which will be quite difficult (although technically possible).