-
1. Re: rich:fileupload not working when include a jsp in the page !
royalmaruthi Jul 15, 2011 1:16 AM (in response to sukhendu83)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 Jul 15, 2011 4:23 AM (in response to royalmaruthi)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