voyent
Liferay Portlet  XML
Forum Index -> General Help
Author Message
Dimitri

Joined: 08/Mar/2008 00:00:00
Messages: 5
Offline


Hello,

I have developped a simple ICEFaces portletwith Netbeans.
Everything work fine but when I click on the maximize button of the portlet, the content become and stay empty even if I refresh the page.
I don't know what I must do to resolve this problem.
If someone can help me ??

Thanks.

The portlet code :
Code:
<%@page contentType="text/html"%>
 <%@page pageEncoding="UTF-8"%>
 
 <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
 <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
 <%@taglib prefix="ice" uri="http://www.icesoft.com/icefaces/component"%>
 
 <f:view>
         <ice:form>
             <%--<ice:outputStyle href="./xmlhttp/css/xp/xp.css"/>--%>
             <ice:outputStyle href="./xmlhttp/css/rime/rime-portlet.css" />
             <ice:panelTabSet>
                 <ice:panelTab id="panelTab1" label="Welcome">
                     <ice:panelGrid id="panelGrid1">
                         <ice:outputText value="Welcome to ICEfaces" />
                     </ice:panelGrid>
                 </ice:panelTab>
                 <ice:panelTab id="panelTab2" label="Calendar">
                     <ice:panelGrid id="panelGrid2" >
                         <!-- Calendar Component -->
                         <ice:selectInputDate id="calendar" value="#{dataBean.selectedDate}" title="Calendar" renderAsPopup="true"></ice:selectInputDate> 
                     </ice:panelGrid>
                 </ice:panelTab>
                 <ice:panelTab id="panelTab3" label="Tab3">
                     <ice:panelGrid id="panelGrid3" >
                         <ice:dataTable id="data" rows="1"
                            var="customer"
                            value="#{dataBean.customerList}"
                            style="float:left"
                            columnWidths="100px,100px,100px,100px"
                            styleClass="dataPaginatorDataTable"
                            cellpadding="0">
                             <ice:column>
                                 <f:facet name="header">
                                     <ice:outputText id="column1" value="Nom"/>
                                 </f:facet>
                                 <ice:outputText id="number" value="#{customer.nom}"/>
                             </ice:column>
 
                             <ice:column>
                                 <f:facet name="header">
                                     <ice:outputText id="column2" value="Prenom"/>
                                 </f:facet>
                                 <ice:outputText id="firstName" value="#{customer.prenom}"/>
                             </ice:column>
                 </ice:panelGrid>
                 </ice:panelTab>
             </ice:panelTabSet>  
         </ice:form>                
 </f:view> 
deryk.sinotte


Joined: 26/Oct/2004 00:00:00
Messages: 1008
Offline


You might want to check out the Developer's Guide for some of the details around portlet development with ICEfaces. One of the things that's missing in your page is the <ice:portlet> component around your content:

Code:
 
 <f:view>
     <ice:portlet>         
          <ice:form>...
 


There may be other useful tidbits in there to help you get going.

Deryk Sinotte
Team Lead
ICEsoft Technologies, Inc.
Dimitri

Joined: 08/Mar/2008 00:00:00
Messages: 5
Offline


Hi,

Thanks for your reply. An error from myself. I have forgotten the tag <portlet>. Resolved.

But I have another small problem.
In my portlet I have datatable, data are correctly added and displayed in the datatable but the columns border are empty.

See screenshot :

The JSP :
Code:
 <f:view>
     <ice:portlet>
         <ice:form>
             <%--<ice:outputStyle href="./xmlhttp/css/rime/rime.css"/>--%>
             <ice:outputStyle href="./xmlhttp/css/rime/rime-portlet.css" />
                     <ice:panelGrid id="panelGrid1">
                         <ice:dataTable id="data" var="log" value="#{logBean.logList}" rows="#{logBean.logList.rowCount}" columnWidths="100px,100px,100px,100px"
                            styleClass="dataPaginatorDataTable"
                            cellpadding="0" scrollHeight="100px" scrollable="true">
                     <ice:column>
                         <f:facet name="header">
                             <ice:outputText id="column1" value="User"/>
                         </f:facet>
                         <ice:outputText id="id" value="#{log.userID}"/>
                     </ice:column>
                     <ice:column>
                         <f:facet name="header">
                             <ice:outputText id="column2" value="Action"/>
                         </f:facet>
                         <ice:outputText id="action" value="#{log.action}"/>
                     </ice:column>
                     <ice:column>
                         <f:facet name="header">
                             <ice:outputText id="column3" value="Date"/>
                         </f:facet>
                         <ice:outputText id="date" value="#{log.date}"/>
                     </ice:column>
                 </ice:dataTable>
             </ice:panelGrid>
         </ice:form>                
     </ice:portlet>
 </f:view>
 


Thanks.

Bye
thorne

Joined: 10/Jun/2008 00:00:00
Messages: 12
Offline


I'm no ICEfaces guru but don't you need to add the following to the column tag:

<ice:column style="border:1px solid grey">....</ice:column>

Hope it helps...

All good things lead to more good things
[Email]
Dimitri

Joined: 08/Mar/2008 00:00:00
Messages: 5
Offline


Hello,

Yes it helps me a lot.
I continue in this thread because I have another little problem with a portlet.
So, I have developped a portlet which allow user to download a file. For that I use a servlet to show the popup to view or download the file. Everything works fine. But If I click a second time on the commandButton which call the method from my bean, this method is never call again.

JSP code :
Code:
 ice:panelGroup styleClass="alignCenter">
                     <ice:panelGrid columns="2" cellpadding="4" cellspacing="4" width="100%">
                         <h:commandButton value="Download" action="#{downloadBean.downloadFile}" />
                     </ice:panelGrid>
                 </ice:panelGroup>
 


Bean method code :
Code:
 public String downloadFile() {
         
         try
         {
             FacesContext context = FacesContext.getCurrentInstance();
             ExternalContext externalContext = context.getExternalContext();
             PortletSession psession = (PortletSession) externalContext.getSession(false);
             
             File file = new File(this.getClass().getResource(SEPARATOR + "Planning" + SEPARATOR + "10129.pdf").getFile());
             
             DataInputStream in = new DataInputStream(new FileInputStream(file));
             byte[] bytes = new byte[(int)file.length()];
             in.readFully(bytes);
             in.close();
             
             psession.setAttribute("DownloadData", bytes, PortletSession.APPLICATION_SCOPE);
             psession.setAttribute("DownloadContentType", "application/pdf", PortletSession.APPLICATION_SCOPE);
             psession.setAttribute("DownloadFileName", file.getName(), PortletSession.APPLICATION_SCOPE);
 
             System.out.println("Path : "+externalContext.getRequestContextPath());
             //on redirige vers la servlet
             externalContext.redirect(externalContext.getRequestContextPath() + "/Download");
             
             context.responseComplete();
         }
         catch(FileNotFoundException ex) {
             System.out.println("FileNotFoundException : "+ex.getMessage());
         }
         catch(IOException ex) {
             System.out.println("IOException : "+ex.getMessage());
         }
         
         return null;
     }
 


Servlet code :
Code:
 protected void processRequest(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
         //response.setContentType("text/html;charset=UTF-8");
         //PrintWriter out = response.getWriter();
         ServletOutputStream out = response.getOutputStream();
         try 
         {
             HttpSession session = request.getSession(false);
             
             String contentType = (String) session.getAttribute("DownloadContentType");
             byte[] bytes = (byte[]) session.getAttribute("DownloadData");
             String filename = (String) session.getAttribute("DownloadFileName");
             
             response.addHeader("Content-disposition", "attachment;filename="+filename);
             response.setContentLength(bytes.length);
             response.getOutputStream().write(bytes);
             response.setContentType(contentType);
             
             out.write(bytes);
 
         } finally { 
             out.close();
         }
     } 
 


Thanks
rlc4810

Joined: 04/Apr/2008 00:00:00
Messages: 14
Offline


Dimitri:

Did you ever come up with a solution for this? I have nearly the identical problem, being discussed in this thread:

http://www.icefaces.org/JForum/posts/list/9718.page

Searching thru the archives, this seems to be a pretty common issue. Is there a more-or-less standard approach to downloading files using ICEFaces?

thx
Dimitri

Joined: 08/Mar/2008 00:00:00
Messages: 5
Offline


Hello,

Sorry for long time of inactivity.
Currently, no solution for this. But maybe by using Ajax Push, you can refresh the button or link which call the download file servlet.
If you solve the problem, it will be very cool to post your solution here or in your post.

Thanks.

Bye
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team