Foros de discusión
Weired Problem with FileUpload example
Axel Nagel, modificado hace 12 años.
Weired Problem with FileUpload example
New Member Mensajes: 20 Fecha de incorporación: 2/09/09 Mensajes recientes
Hi,
I'm testing the JSF Portlet Bridge with liferay6.0, tomcat for a scientific project:
I tried to create a simple upload Portlet and came to the following problem.
The upload only works if I add a second form with the same id in a separate layout.
Without the second form I get the HtmlInputFile but the UploadedFile is null.
It seems there is no full submit without the second form.
I would be very grateful about any hint how to get a full submit going without the second form.
This seems to be related to http://www.liferay.com/community/forums/-/message_boards/message/13290259 where the problem hasn't been resolved (switched to ace:fileEntry instead).
Axel
p.s: The forum seems to be broken, I wrote the post serveral times and everything vanished when pressing preview or save as draft ????
I trimmed the code from this example:
https://github.com/liferay/liferay-faces/blob/master/demos/bridge/jsf2-portlet/tags/1.0.0/src/main
I'm testing the JSF Portlet Bridge with liferay6.0, tomcat for a scientific project:
I tried to create a simple upload Portlet and came to the following problem.
The upload only works if I add a second form with the same id in a separate layout.
Without the second form I get the HtmlInputFile but the UploadedFile is null.
It seems there is no full submit without the second form.
I would be very grateful about any hint how to get a full submit going without the second form.
This seems to be related to http://www.liferay.com/community/forums/-/message_boards/message/13290259 where the problem hasn't been resolved (switched to ace:fileEntry instead).
Axel
p.s: The forum seems to be broken, I wrote the post serveral times and everything vanished when pressing preview or save as draft ????
I trimmed the code from this example:
https://github.com/liferay/liferay-faces/blob/master/demos/bridge/jsf2-portlet/tags/1.0.0/src/main
<!--?xml version="1.0"?-->
<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://portletfaces.org/bridge" xmlns:aui="http://portletfaces.org/alloyfaces/aui">
<h:head />
<h:body>
<p>Upload your data sets.</p>
<aui:layout id="l1">
<h:form id="f1">
</h:form>
</aui:layout>
<aui:layout id="l2">
<h:form enctype="multipart/form-data" id="f1" method="POST">
<p:inputfile binding="#{uploadController.uploadedFile}" />
<h:commandbutton actionListener="#{uploadController.upload}" value="upload" />
</h:form>
</aui:layout>
</h:body>
</f:view>
package eu.dropsproject.data;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.event.ActionEvent;
import org.portletfaces.bridge.component.HtmlInputFile;
@ManagedBean(name = "uploadController")
@RequestScoped
public class UploadController implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private transient HtmlInputFile uploadedFile;
public void setUploadedFile(HtmlInputFile uploadedFile) {
this.uploadedFile = uploadedFile;
}
public HtmlInputFile getUploadedFile() {
return uploadedFile;
}
public void upload(ActionEvent actionEvent) {
System.out.println("uploading now + " + uploadedFile.toString() + "!!");
try {
if (uploadedFile.getUploadedFile() != null)
System.out.println("uploading now + "
+ uploadedFile.getUploadedFile().toString() + "!!");
else
System.out.println("empty upload");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Johann Kneringer, modificado hace 12 años.
RE: Weired Problem with FileUpload example
Junior Member Mensajes: 42 Fecha de incorporación: 10/11/11 Mensajes recientes
Did you find a solution for this?
Axel Nagel, modificado hace 12 años.
RE: Weired Problem with FileUpload example
New Member Mensajes: 20 Fecha de incorporación: 2/09/09 Mensajes recientes
NOPE,
As far as I remember from that time and don't pin me on that:
ICEFACES clashed with the liferay 6 server, I haven't looked into it, if that is already fixed.
I ran some of the icefaces examples using liferay 6. and 5.3.2.
I also downloaded the the community edition of the liferay icefaces eclipse plugin 6.1 and found different version of the libraries used there.
I also combined exchanged libraries of different version and got the file upload working , sorry can't remember which version, but anyway that rendered other parts of the icefaces not working.
So spending some days on it I decided it to be currently unfit, even if liked to have used it.
See this section for some clarification:
http://wiki.icefaces.org/display/ICE/Portlet+Development
especially:
If you find out that things work out with a new release I would be glad to here as I like the general concept.
Axel
As far as I remember from that time and don't pin me on that:
ICEFACES clashed with the liferay 6 server, I haven't looked into it, if that is already fixed.
I ran some of the icefaces examples using liferay 6. and 5.3.2.
I also downloaded the the community edition of the liferay icefaces eclipse plugin 6.1 and found different version of the libraries used there.
I also combined exchanged libraries of different version and got the file upload working , sorry can't remember which version, but anyway that rendered other parts of the icefaces not working.
So spending some days on it I decided it to be currently unfit, even if liked to have used it.
See this section for some clarification:
http://wiki.icefaces.org/display/ICE/Portlet+Development
especially:
ACE Portlets
With the exception of the File Entry component, ACE components do not currently run on Liferay due to a YUI library conflict. This will be rectified in a later release. See ICEfaces 2.0.0 Release Notes for a full list of issues pertaining to portlets and ICEfaces 2.
If you find out that things work out with a new release I would be glad to here as I like the general concept.
Axel
Neil Griffin, modificado hace 11 años.
RE: Weired Problem with FileUpload example
Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Axel,
If you get a chance, please try this with Liferay Faces Bridge. If it's still a problem, then please modify the jsf2-portlet or icefaces3-portlet demo so that it reproduces the problem and then upload it here.
Also, I wanted to point out that Liferay Faces Bridge also supports the PrimeFaces p:fileUpload component with multi-file Ajax upload. See the primefaces3-portlet demo for more details.
If you get a chance, please try this with Liferay Faces Bridge. If it's still a problem, then please modify the jsf2-portlet or icefaces3-portlet demo so that it reproduces the problem and then upload it here.
Also, I wanted to point out that Liferay Faces Bridge also supports the PrimeFaces p:fileUpload component with multi-file Ajax upload. See the primefaces3-portlet demo for more details.