Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Axel Nagel
Weired Problem with FileUpload example
10 de abril de 2012 16:00
Respuesta

Axel Nagel

Ranking: New Member

Mensajes: 20

Fecha de incorporación: 2 de septiembre de 2009

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

 1
 2<?xml version="1.0"?>
 3
 4<f:view xmlns:f="http://java.sun.com/jsf/core"
 5    xmlns:h="http://java.sun.com/jsf/html"
 6    xmlns:ui="http://java.sun.com/jsf/facelets"
 7    xmlns:p="http://portletfaces.org/bridge"
 8    xmlns:aui="http://portletfaces.org/alloyfaces/aui">
 9    <h:head />
10    <h:body>
11        <p>Upload your data sets.</p>
12        <aui:layout id="l1">
13            <h:form id="f1">
14            </h:form>
15        </aui:layout>
16        <aui:layout id="l2">
17            <h:form enctype="multipart/form-data" id="f1" method="POST">
18                <p:inputFile binding="#{uploadController.uploadedFile}" />
19                <h:commandButton actionListener="#{uploadController.upload}"
20                    value="upload" />
21            </h:form>
22        </aui:layout>
23    </h:body>
24</f:view>



 1
 2package eu.dropsproject.data;
 3
 4import java.io.Serializable;
 5
 6import javax.faces.bean.ManagedBean;
 7import javax.faces.bean.RequestScoped;
 8import javax.faces.event.ActionEvent;
 9
10import org.portletfaces.bridge.component.HtmlInputFile;
11
12@ManagedBean(name = "uploadController")
13@RequestScoped
14public class UploadController implements Serializable{
15    /**
16     *
17     */
18    private static final long serialVersionUID = 1L;
19    private transient HtmlInputFile uploadedFile;
20
21    public void setUploadedFile(HtmlInputFile uploadedFile) {
22        this.uploadedFile = uploadedFile;
23    }
24
25    public HtmlInputFile getUploadedFile() {
26        return uploadedFile;
27    }
28   
29    public void upload(ActionEvent actionEvent) {
30        System.out.println("uploading now + " + uploadedFile.toString() + "!!");
31        try {
32            if (uploadedFile.getUploadedFile() != null)
33                System.out.println("uploading now + "
34                        + uploadedFile.getUploadedFile().toString() + "!!");
35            else
36                System.out.println("empty upload");               
37        } catch (Exception e) {
38            e.printStackTrace();
39        }
40    }
41}
Johann Kneringer
RE: Weired Problem with FileUpload example
30 de noviembre de 2011 6:20
Respuesta

Johann Kneringer

Ranking: Junior Member

Mensajes: 42

Fecha de incorporación: 10 de noviembre de 2011

Mensajes recientes

Did you find a solution for this?
Axel Nagel
RE: Weired Problem with FileUpload example
30 de noviembre de 2011 6:40
Respuesta

Axel Nagel

Ranking: New Member

Mensajes: 20

Fecha de incorporación: 2 de septiembre de 2009

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:

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
RE: Weired Problem with FileUpload example
8 de mayo de 2012 8:43
Respuesta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 2350

Fecha de incorporación: 26 de julio de 2005

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.