I'm using PrimeFaces <p:fileUpload>. It does not invoke the listener method. If I add the FileUploadFilter, then I get an exception.
View:
<h:form enctype="multipart/form-data">
<p:fileUpload mode="advanced"
fileUploadListener="#{fileUploadController.upload()}"
allowTypes="/(\.|\/)(gif|jpg|jpeg|gif|png|PNG|GIF|JPG|JPEG)$/"
auto="false" />
</h:form>
Bean:
public class fileUploadController {
private String destination = "c:\test";
public void upload(FileUploadEvent event) {
FacesMessage msg = new FacesMessage("Success! ", event.getFile()
.getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
// Do what you want with the file
try {
copyFile(event.getFile().getFileName(), event.getFile()
.getInputstream());
} catch (IOException e) {
e.printStackTrace();
}
}
public void copyFile(String fileName, InputStream in) {
try {
// write the inputStream to a FileOutputStream
OutputStream out = new FileOutputStream(new File(destination
+ fileName));
int read = 0;
byte[] bytes = new byte[1024];
while ((read = in.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
in.close();
out.flush();
out.close();
System.out.println("New file created!");
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
web.xml
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
fileUploadListener="#{fileUploadController.upload()}" is problem here. I reproduced that and I also got an exception Method not found:
You should define fileUploadListener whithout parentheses. When you have added parentheses, expected method in your bean is upload() and not upload(FileUploadEvent event)
Related
I'm trying to upload files via primefaces 10.0.. I got the below error msg :
"Cannot convert org.primefaces.model.file.UploadedFilesWrapper#7200b7ba of type class org.primefaces.model.file.UploadedFilesWrapper to interface org.primefaces.model.file.UploadedFile"
code as below :
XHTML:
<h:form enctype="multipart/form-data">
<p:fileUpload uploadLabel="aa" cancelLabel="aa" value="#{managedBean.fileToUpload}"
mode="simple" skinSimple="true" multiple="true" />
<p:commandButton action="#{managedBean.uploadFileDone()}" value="upload" />
</h:form>
ManagedBean:
public void uploadFileDone(){
System.out.println(fileDetailActivite);
this.upload(fileDetailActivite,"Activite_"+activite.getId()+".pdf");
}
public void upload(UploadedFile file,String type) {
if (file != null) {
// System.out.println("FileUploadEvent");
String path = "C:\\tmp\\";
File dir = new File (path);
dir.mkdirs();
FacesMessage msg = new FacesMessage("Success! ", file.getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
// Do what you want with the file
try {
InputStream
inputStream = file.getInputStream();
copyFile(file.getFileName(), inputStream,type);
} catch (IOException e) {
e.printStackTrace();
}
FacesMessage message = new FacesMessage("Successful", file.getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, message);
}
}
public void copyFile(String fileName, InputStream in,String type) {
// System.out.println("copyFile");
try {
// write the inputStream to a FileOutputStream
fileName=" ";
// OutputStream out = new FileOutputStream(new File(destination + type+"_"+fileName));
OutputStream out = new FileOutputStream(new File(destination +type+""+fileName));
int read = 0;
byte[] bytes = new byte[1024];
while ((read = in.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
in.close();
out.flush();
out.close();
System.out.println("New file created!");
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
When using multiple="true", you need a UploadedFiles property instead of a UploadedFile property so that it can hold multiple files instead of only one.
private UploadedFiles files;
<p:fileUpload value="#{bean.files}" multiple="true" />
Or, if that was not your intent, then you need to remove the multiple="true" attribute.
private UploadedFile file;
<p:fileUpload value="#{bean.file}" />
Good morning.
I have a problem when I try to perform logout in the authenticated system via a digital certificate.
To better describe the problem is as follows:
The browser presented the certificates for authentication check box, selecting and providing the PIN for the certificate selected the system performs login normally. The problem is when the user triggers the logout button, it invalidates the session and redirects to the login screen again. However when the user clicks the button that redirects to a restricted area the browser should resubmit the certificate selection box, but the same goes direct, using the certificate information selected in the previous login.
If we stop the server or close and open the browser it will prompt the choice of certificate again.
standalone.xml:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="8443"/>
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
<ssl key-alias="localhost" verify-client="true"/>
</connector>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
web.xml:
<filter>
<filter-name>Authentication X509Certificate Filter</filter-name>
<filter-class>br.gov.sp.sefin.desif.security.servlet.AuthX509CertificateFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Authentication X509Certificate Filter</filter-name>
<url-pattern>/pages/*</url-pattern>
</filter-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>pages/*</web-resource-name>
<url-pattern>/pages/*</url-pattern>
<http-method>GET</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>CLIENT-CERT</auth-method>
</login-config>
Filter authentication AuthX509CertificateFilter :
public class AuthX509CertificateFilter implements Filter {
private static final String MS_005 = "MS_005";
private static final String URI_DEFINIR_IF = "/internet/pages/home.xhtml";
private Principal authenticatedUser;
#Inject
private RepresentanteBO representanteBO;
#Inject
private InstituicaoFinanceiraBO instituicaoFinanceiraBO;
#Override
public void init(FilterConfig filterConfig) throws ServletException {
}
#Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
Object attrSessionValid = req.getSession().getAttribute("sessionValid");
Object attrSessionAuthenticated = req.getSession().getAttribute("authenticated");
Object attrSessionInstituicaoFinanceira = req.getSession().getAttribute("instituicaoFinanceiraInternet");
Boolean sessionValid = (Boolean) (attrSessionValid != null ? attrSessionValid : Boolean.FALSE);
Boolean sessionAuthenticated = (Boolean) (attrSessionAuthenticated != null ? attrSessionAuthenticated : Boolean.FALSE);
if(!sessionValid || (URI_DEFINIR_IF.equals(req.getRequestURI()) && attrSessionInstituicaoFinanceira == null)) {
X509Certificate certs[] = (X509Certificate[] )req.getAttribute("javax.servlet.request.X509Certificate");
if(certs != null) {
X509Certificate t = (X509Certificate) certs[0];
Principal subjectDN = t.getSubjectDN();
authenticatedUser = subjectDN;
sessionAuthenticated = validarAutenticacao(subjectDN, req, resp);
chain.doFilter(new HttpServletRequestWrapper(req) {
#Override
public Principal getUserPrincipal() {
return authenticatedUser;
}
}, response);
}
} else {
Principal userPrincipal = req.getUserPrincipal();
if(userPrincipal != null) {
sessionAuthenticated = validarAutenticacao(userPrincipal, req, resp);
}
chain.doFilter(new HttpServletRequestWrapper(req) {
#Override
public Principal getUserPrincipal() {
return authenticatedUser;
}
}, response);
}
if(!resp.isCommitted() && !sessionAuthenticated) {
Object attribute = req.getSession().getAttribute("cpfCnpj");
if(attribute != null)
req.getSession().setAttribute(MS_005, MessagePtBrUtil.recupera(MS_005, UtilFormatter.formatarCPF((String) attribute)));
RequestDispatcher dispatcher = req.getRequestDispatcher("../login.xhtml");
dispatcher.forward(req, resp);
}
}
public void atualizarDadosDeSessao(HttpServletRequest req, Boolean sessionValid, Boolean sessionAuthenticated) {
req.getSession().setAttribute("sessionValid", sessionValid);
req.getSession().setAttribute("authenticated", sessionAuthenticated);
}
public Boolean validarAutenticacao(Principal userPrincipal, HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Boolean sessionValid = Boolean.TRUE;
Boolean sessionAuthenticated = Boolean.TRUE;
String[] cn = userPrincipal.getName().split(",");
String cpfCnpj = cn[0].split(":")[1];
req.getSession().setAttribute("cpfCnpj", cpfCnpj);
BigInteger raizCnpj = new BigInteger(cpfCnpj.substring(0, 8));
if(cpfCnpj.length() == 14 && instituicaoFinanceiraBO.verificarInstituicaoFinanceiraRaizCnpj(raizCnpj)) {
RequestDispatcher dispatcher = req.getRequestDispatcher("../pages/home.xhtml");
dispatcher.forward(req, resp);
} else {
BigInteger cpf = new BigInteger(cpfCnpj);
if(representanteBO.verificarRepresentanteInstituicaoFinanceira(cpf)) {
RequestDispatcher dispatcher = req.getRequestDispatcher("../pages/autenticarusuario/definirInstituicaoFinanceira.xhtml?cpf="+cpf);
dispatcher.forward(req, resp);
} else { // não tem instituição financeira vinculada ao CPF
sessionValid = Boolean.FALSE; sessionAuthenticated = Boolean.FALSE;
}
}
atualizarDadosDeSessao(req, sessionValid, sessionValid);
return sessionValid && sessionAuthenticated;
}
#Override
public void destroy() {
}
}
Logout method:
public void sair() {
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
this.inserirLogAuditoriaLogout();
context.invalidateSession();
HttpServletRequest request = (HttpServletRequest) context.getRequest();
request.getSession().setAttribute("sessionValid", Boolean.FALSE);
request.getSession().setAttribute("authenticated", Boolean.FALSE);
try {
request.logout();
context.redirect("/internet/login.xhtml");
} catch (IOException e) {
new IOException();
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
I've tried using some javascript solutions to perform the cleaning of the certificate for authentication data stored in the browser. Example:
window.crypto.logout();
document.execCommand("ClearAuthenticationCache");
function logOut()
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.timeout = 2000; // 2 seconds
xmlHttp.onreadystatechange = function ()
{
if (xmlHttp.readyState == 4)
{
console.log("status: "+xmlHttp.status);
console.log("response: '"+xmlHttp.responseText+"'");
}
};
xmlHttp.open("GET", "/internet/login.xhtml", true);
xmlHttp.send();
}
But did not work.
Please if anyone has been there and succeeded in solve it present your solution.
I hope I can have been clear in the description of the problem. I am available to best describes it.
I thank you so much attention.
i'm having a problem to get the fullPath of a file which i upload using primefaces component . This is my code:
<h:form prependId="false" enctype="multipart/form-data">
<p:fileUpload update="#form" mode="advanced" auto="true"
fileUploadListener="#{myBean.myFileUpload}"/>
<h:outputText value="#{myBean.fileName}"/>
</h:form>
#ManagedBean
#SessionScoped
public class MyBean {
private String fileName;
public void myFileUpload(FileUploadEvent event) {
FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
fileName = event.getFile().getFileName();
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
}
i only get the file's name but what i really want to get is the full path.
i already try this but it doesn't show anything.
fileName = FilenameUtils.getFullPath(event.getFile().getFileName());
What would you expect as fullPath of an uploaded file? The Browser sent you some bytes, they are in the memory of the servletcontainer and nowhere stored. There is no fullPath like /var/tmp/myfile.txt.
Try this:
String fileName = event.getFile().getFileName();
ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
String newFileName = servletContext.getRealPath("") + File.separator + "upload" + File.separator+ fileName;
where "upload" must be replaced by name given in web.xml configuration for prime faces:
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>uploadDirectory</param-name>
<param-value>/upload</param-value>
</init-param>
</filter>
I'm still on the road of learning JSF. I have an IceFaces tree with an IceFaces commandLink to try to download a file. So far this is my xhtml and my backing bean. When I click the commandLink it just prints the two messages and then it does nothing and it does not show any warning any error at all... How to know what's happening? What am I missing?
Cheers
XHTML
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form>
<ice:tree id="tree"
value="#{treeBean.model}"
var="item"
hideNavigation="false"
hideRootNode="false"
imageDir="./images/">
<ice:treeNode>
<f:facet name="icon">
<ice:panelGroup style="display: inline">
<h:graphicImage value="#{item.userObject.icon}"/>
</ice:panelGroup>
</f:facet>
<f:facet name="content">
<ice:panelGroup style="display: inline">
<ice:commandLink action="#{treeBean.doDownload(item.userObject.fileAbsolutePath)}">
<ice:outputText value="#{item.userObject.text}"/>
</ice:commandLink>
</ice:panelGroup>
</f:facet>
</ice:treeNode>
</ice:tree>
</h:form>
</h:body>
</html>
BEAN
#ManagedBean
#ViewScoped
public class TreeBean implements Serializable {
private final DefaultTreeModel model;
/** Creates a new instance of TreeBean */
public TreeBean() {
// create root node with its children expanded
DefaultMutableTreeNode rootTreeNode = new DefaultMutableTreeNode();
IceUserObject rootObject = new IceUserObject(rootTreeNode);
rootObject.setText("Root Node");
rootObject.setExpanded(true);
rootObject.setBranchContractedIcon("./images/tree_folder_close.gif");
rootObject.setBranchExpandedIcon("./images/tree_folder_open.gif");
rootObject.setLeafIcon("./images/tree_document.gif");
rootTreeNode.setUserObject(rootObject);
// model is accessed by by the ice:tree component via a getter method
model = new DefaultTreeModel(rootTreeNode);
// add some child nodes
for (int i = 0; i < 3; i++) {
DefaultMutableTreeNode branchNode = new DefaultMutableTreeNode();
FileSourceUserObject branchObject = new FileSourceUserObject(branchNode);
branchObject.setText("SteveJobs.jpg");
branchObject.setFileAbsolutePath("/Users/BRabbit/Downloads/SteveJobs.jpg");
branchObject.setBranchContractedIcon("./images/tree_folder_close.gif");
branchObject.setBranchExpandedIcon("./images/tree_folder_open.gif");
branchObject.setLeafIcon("./images/tree_document.gif");
branchObject.setLeaf(true);
branchNode.setUserObject(branchObject);
rootTreeNode.add(branchNode);
}
}
public DefaultTreeModel getModel() {
return model;
}
public void doDownload(String fileAbsolutePath) {
System.out.println(fileAbsolutePath);
File file = new File(fileAbsolutePath);
if(file.exists())
System.out.println("Yes"); //It exists !
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
externalContext.setResponseHeader("Content-Type", externalContext.getMimeType(file.getName()));
externalContext.setResponseHeader("Content-Length", String.valueOf(file.length()));
externalContext.setResponseHeader("Content-Disposition", "attachment;filename=\"" + file.getName() + "\"");
InputStream input = null;
OutputStream output = null;
try {
input = new FileInputStream(file);
output = externalContext.getResponseOutputStream();
IOUtils.copy(input, output);
} catch (FileNotFoundException ex) {
Logger.getLogger(TreeBean.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(TreeBean.class.getName()).log(Level.SEVERE, null, ex);
} finally {
IOUtils.closeQuietly(output);
IOUtils.closeQuietly(input);
}
facesContext.responseComplete();
}
}
Bean's object
public class FileSourceUserObject extends IceUserObject{
String fileAbsolutePath;
public FileSourceUserObject(DefaultMutableTreeNode wrapper) {
super(wrapper);
}
public String getFileAbsolutePath(){
return fileAbsolutePath;
}
public void setFileAbsolutePath(String fileAbsolutePath){
this.fileAbsolutePath = fileAbsolutePath;
}
}
Finally I did it!
Here's some code that allows the user to see a tree (of Files) and download them.
XHTML
<ice:tree id="tree"
value="#{treeBean.model}"
var="item"
hideNavigation="false"
hideRootNode="false"
imageDir="./images/">
<ice:treeNode>
<f:facet name="icon">
<ice:panelGroup style="display: inline">
<h:graphicImage value="#{item.userObject.icon}"/>
</ice:panelGroup>
</f:facet>
<f:facet name="content">
<ice:panelGroup style="display: inline-block">
<ice:outputResource resource="#{item.userObject.resource}"
fileName="#{item.userObject.text}"
shared="false"/>
</ice:panelGroup>
</f:facet>
</ice:treeNode>
</ice:tree>
BACKING BEAN
#ManagedBean
#ViewScoped
public class TreeBean implements Serializable {
private final DefaultTreeModel model;
public TreeBean() {
DefaultMutableTreeNode rootTreeNode = new DefaultMutableTreeNode();
FileSourceUserObject rootObject = new FileSourceUserObject(rootTreeNode);
rootObject.setText("Root Node");
rootObject.setExpanded(true);
rootObject.setBranchContractedIcon("./images/tree_folder_close.gif");
rootObject.setBranchExpandedIcon("./images/tree_folder_open.gif");
rootTreeNode.setUserObject(rootObject);
// model is accessed by by the ice:tree component via a getter method
model = new DefaultTreeModel(rootTreeNode);
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
// add some child nodes
for (int i = 0; i < 3; i++) {
DefaultMutableTreeNode branchNode = new DefaultMutableTreeNode();
FileSourceUserObject branchObject = new FileSourceUserObject(branchNode);
branchObject.setText("Test.jpg");
branchObject.setResource(new SRCResource("/<filePath>/Test.jpg"));
branchObject.setBranchContractedIcon("./images/tree_folder_close.gif");
branchObject.setBranchExpandedIcon("./images/tree_folder_open.gif");
branchObject.setLeafIcon("./images/tree_document.gif");
branchObject.setLeaf(true);
branchNode.setUserObject(branchObject);
rootTreeNode.add(branchNode);
}
}
public DefaultTreeModel getModel() {
return model;
}
}
SRCResource
public class SRCResource implements Resource {
private String fileAbsolutePath;
private final Date lastModified;
public SRCResource(String fileAbsolutePath) {
this.fileAbsolutePath = fileAbsolutePath;
this.lastModified = new Date();
}
#Override
public String calculateDigest() {
return "No lo calcularé jamás !!";
}
#Override
public InputStream open() throws IOException {
return (InputStream)(new FileInputStream(fileAbsolutePath));
}
#Override
public Date lastModified() {
return lastModified;
}
#Override
public void withOptions(Options optns) throws IOException {
}
public String getFileAbsolutePath() {
return fileAbsolutePath;
}
public void setFileAbsolutePath(String fileAbsolutePath) {
this.fileAbsolutePath = fileAbsolutePath;
}
}
Web.xml
Add the following
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.CompatResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/icefaces/*</url-pattern>
</servlet-mapping>
And that's it ! Simply adapt the code to your needs !
Cheers !
More info on http://wiki.icefaces.org/display/ICE/Adding+ICEfaces+to+Your+Application
I have a form with a p:fileUpload, and when I submit the form, all methods are not fired
This is my xhtml :
<h:form enctype="multipart/form-data">
<p:messages id="messages" showDetail="true"/>
<p:fileUpload value="#{uploadBean.file}" mode="simple" id="fileUploadId"/>
<p:commandButton value="Envoyer ce fichier" process="#form" update="messages fileUploadId" actionListener="#{uploadBean.upload}"/>
</h:form>
my bean :
public void setFile(final UploadedFile file)
{
System.out.println("Dans le setFile");
this.file = file;
}
public void upload()
{
System.out.println("Dans le upload");
System.out.println("Fichier : " + file.getFileName());
FacesContext.getCurrentInstance().addMessage(null, msg);
}
my web.xml :
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>
org.primefaces.webapp.filter.FileUploadFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
In the trace, I have just :
Infos: Dans le upload
Grave: Réception de «java.lang.NullPointerException» lors de l’invocation du listener d’action «#{uploadBean.upload}» du composant «j_idt11»
Grave: java.lang.NullPointerException
The method setFile() is not call...
Thanks
edit :
All the code of my bean :
import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import org.primefaces.event.FileUploadEvent;
import org.primefaces.model.UploadedFile;
#ManagedBean
#ViewScoped
public class UploadBean implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 556636819990963651L;
private UploadedFile file;
public UploadedFile getFile()
{
System.out.println("Dans le getFile");
return file;
}
public void setFile(final UploadedFile file)
{
System.out.println("Dans le setFile");
this.file = file;
}
public void upload()
{
System.out.println("Dans le upload");
// System.out.println("Fichier : " + file.getFileName());
FacesMessage msg;
if (file == null)
{
msg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Raté ! ", "Le fichier vaut null.");
System.out.println("la variable file : null");
}
else
{
msg = new FacesMessage("Ouép ! ", file.getFileName() + " is uploaded.");
System.out.println("Le nom du fichier uploader est : " + file.getFileName());
}
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
From what you provided, I think you have done correctly so far. However, there are still 2 things you need to take care of:
You need to download common-io & common-fileupload and import the .jar file into your Library folder.
You also need to make sure that there are no other filters in web.xml or any classes that are annotated with #WebFilter which may read the HttpServletRequest#getInputStream() before PrimeFaces's filter, because it can be read only once.
You are using prettyfaces too? Then try it (set dispatcher):
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
I had a similar issue, the form was not submitted and the setters methods were never called, add
<f:ajax event="change"/>
inside the component what u want to submit. also
"immediate=true"
on the component itself. Thought might be helpful to others..