2 Replies Latest reply on Jul 15, 2011 4:23 AM by sukhendu83

    rich:fileupload not working when include a jsp in the page !

    sukhendu83

      Hi All,

       

      I am using rich:fileupload component, version 3.2.1. The fileupload is working fine, there is also a rich:datatable with a datascroller. Now I want to add a jsp page which contains the header portion of that page which contains a logo and few links like logout, home etc fetched from a bean. I am using jsp:include to include the jsp page. Now in my file upload page header is showing the logo, link and working fine, but when I try to upload a file or clicking the data scroller it give me error like

       

      org.apache.jasper.JasperException: An exception occurred processing JSP page /testPage.jsp at line 96

       

      I have include a simple jsp which containt few text, and works fine.

       

      I have also tried <a4j:include viewId=testPage.jsp/> but got the same result.

       

      Can you please tell me where I am gonig wrong or is there any other way to do this ?

       

      Thanks,

       

      Sukhendu

        • 1. Re: rich:fileupload not working when include a jsp in the page !
          royalmaruthi

          Hi Sukhendu,

           

          Please share me the code which you have implemented to be identify the issue.

          • 2. Re: rich:fileupload not working when include a jsp in the page !
            sukhendu83

            Thanks Maruthi for reply.. here is my code

             

             

            fileupload.jsp

            ----------------------

            <%@ page language="java" pageEncoding="UTF-8"%> 

                <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> 

                <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> 

                <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>

                <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>  

             

                <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 

                <html> 

                <head> 

                    <title>File Upload</title>

            </head> 

            <body> 

            <f:view> 

            <h:form id="uploadForm" enctype="multipart/form-data">

                 <div style="width: 100%">

                                <f:subview id="subview1"> 

                                    <jsp:include page ="../header.jsp" />

                                </f:subview>

                  </div>

            <h:panelGrid columns="2" columnClasses="top,top">

                            <rich:fileUpload transferErrorLabel="" cancelEntryControlLabel="Clear" ajaxSingle="true" fileUploadListener="#{fileUploadBean.listener}"

                                maxFilesQuantity="#{fileUploadBean.uploadsAvailable}"

                                id="upload"

                                immediateUpload="#{fileUploadBean.autoUpload}"

                                acceptedTypes="csv">

                                <a4j:support event="onuploadcomplete" reRender="info" />

                                <a4j:support event="onerror" reRender="info"/>

                            </rich:fileUpload>

                            <h:panelGroup id="info">

                                <rich:panel bodyClass="info">

                                    <f:facet name="header">

                                        <h:outputText value="Uploaded Files Info" />

                                    </f:facet>

                                    <h:outputText value="No files currently uploaded"

                                        rendered="#{fileUploadBean.size==0}" />

                                    <p><h:outputText value="#{fileUploadBean.errorMsg}" style="font-family:'Verdana'; color:#FF0000; font-size:11px;"/></p>

                                    <rich:dataGrid columns="1" value="#{fileUploadBean.files}"

                                        var="file" rowKeyVar="row">

                                        <rich:panel bodyClass="rich-laguna-panel-no-header">

                                            <h:panelGrid columns="2">

                                                <h:panelGrid columns="2" style=" font-family:'Verdana'; color:#000000; font-size:11px;">

                                                    <h:outputText value="File Name:" />

                                                    <h:outputText value="#{file.name}" />

                                                </h:panelGrid>

                                            </h:panelGrid>

                                        </rich:panel>

                                    </rich:dataGrid>

                                </rich:panel>

                            <rich:spacer height="3"/>

                            <br />

                            <a4j:commandButton action="#{fileUploadBean.clearUploadData}"

                                reRender="info, upload" value="Clear Uploaded Data"

                                rendered="#{fileUploadBean.size>0}" />

                          </h:panelGroup>

                    </h:panelGrid>

            </h:form> 

            </f:view> 

            </body> 

            </html>

             

             

            header.jsp

            ------------------------------

            <%@ taglib uri="/WEB-INF/upload.tld" prefix="uptag" %>

                <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> 

                <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

            <%

            String reqPage = "";

            reqPage = reqPage.concat("/headersection.jsp");

            %>

            <div>.......</div>

            <div>...</div>              

             

            headersection.jsp

            -------------------------------

            <%@ page import="menuapp.*"%>

            <%@ taglib uri="/WEB-INF/upload.tld" prefix="uptag" %>

            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> 

            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

            <%

            response.setHeader("Cache-Control", "no-cache");

            response.setHeader("Pragma", "no-cache");

            response.setDateHeader("max-age", 0);

            response.setDateHeader("Expires", 0);

             

            String webAppearance = "";

            HeaderBn headerbn  = (HeaderBn)request.getAttribute("hdrbnforpagesecn");

            String thisPath = ServerSupportUtil.getParameterValue(request, "thisPath");

            String imagePath = ServerSupportUtil.getParameterValue(request, "imagePath");

            String sMenuFor = ServerSupportUtil.getParameterValue(request, "sMenuFor");

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            <%@page import="java.util.Vector"%>

            <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

                <head>

                            <meta http-equiv="Cache-Control" content="no-cache"/>

                            <meta http-equiv="Pragma" content="no-cache"/>

                            <meta http-equiv="max-age" content="0"/>

                            <meta http-equiv="Expires" content="0"/>

                 </head>

            <body>

            <div><img src="<%= imagePath %><%= headerbn.getLogoLink() %>" alt="Logo"/></div><br /><br />

            <%

            String logoutLink = headerbn.getLogoutLink();

            DelimitedString dsLogoutLink = new DelimitedString(logoutLink);

            %>

            <a style="margin-left:5px;" href="<%=ServerSupportUtil.getURL(response,MenuAppUtil.getUnEncodedServletPath()+"?dirc="+dsLogoutLink.getString(2)) %>" id="signoff" title="Sign Off - Select" class="selected"><%=dsLogoutLink.getString(1)%></a>

             

             

            faces-config.xml

            ---------------------------

            <managed-bean>

                  <description>FileUploadBn Bean</description>

                  <managed-bean-name>fileUploadBean</managed-bean-name>

                  <managed-bean-class>app.FileUploadBn</managed-bean-class>

                  <managed-bean-scope>session</managed-bean-scope>

               </managed-bean>

             

             

             

             

             

             

            Now if I remove  this

             

            <div style="width: 100%">

                 <f:subview id="subview1"> 

                          <jsp:include page ="../header.jsp" />

                 </f:subview>

            </div>

             

            from fileupload.jsp everything works fine.

             

            Please let me know if you need anything else

             

            Thanks,

             

            Sukhendu