Which IIQ version are you inquiring about?
8.4
Hi Experts,
Was trying to develop file upload utility in identityiq8.4 referring to this Upload file QuickLink - Compass
Stuck at below error while click submit button. Anyone has any idea?
<EventMessage>Caught unhandled JSF exception: Unable to create managed bean fileUploadClass. The following problems were found:
- Bean or property class sailpoint.services.standard.fileUpload.FileUploadClass for managed bean fileUploadClass cannot be found.</EventMessage>
<Stacktrace>com.sun.faces.mgbean.ManagedBeanCreationException: Unable to create managed bean fileUploadClass. The following problems were found:
- Bean or property class sailpoint.services.standard.fileUpload.FileUploadClass for managed bean fileUploadClass cannot be found.
xhtml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:sp="http://sailpoint.com/ui"
xmlns:p="http://primefaces.org/ui">
<h:body>
<ui:composition template="/ngAppPage.xhtml">
<ui:define name="body">
<h:form enctype="multipart/form-data">
<p:panel header="Upload Section"
style="padding:1.5rem; background-color:#f9f9f9; border:1px solid #ccc; border-radius:8px; box-shadow:0 0 5px rgba(0,0,0,0.1);">
<f:facet name="header">
<h:outputText value="File Upload Section"
style="font-size:2rem; color:#037DA1; font-weight:bold;" />
</f:facet>
<h:panelGrid columns="1" style="row-gap:1rem;">
<h:outputLabel value="đ File Upload to Server"
style="font-weight:bold; font-size:1.2rem; color:#333;" />
<p:fileUpload value="#{fileUploadClass.uploadFile}"
mode="simple"
dragDropSupport="true"
update="messages"
style="width:100%; font-weight:bold; font-size:1.2rem; color:#333;" />
<h:commandButton value="Submit"
action="#{fileUploadClass.uploadFileMethod}"
style="margin-top:3rem; background-color:#007ad9; color:white; padding:0.5rem 1rem; border:none; border-radius:4px;"
onmouseover="this.style.backgroundColor='#005ea3';"
onmouseout="this.style.backgroundColor='#007ad9';" />
</h:panelGrid>
</p:panel>
<h:messages id="messages" style="margin-top:1rem; font-size:0.95rem; color:#444;" />
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
java class:
package sailpoint.services.standard.fileUpload;
import org.primefaces.model.UploadedFile;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import java.io.*;
@ManagedBean(name = "fileUploadClass")
@SessionScoped
public class FileUploadClass {
private UploadedFile uploadFile;
public UploadedFile getUploadFile() {
return uploadFile;
}
public void setUploadFile(UploadedFile uploadFile) {
this.uploadFile = uploadFile;
}
public String uploadFileMethod() {
if (uploadFile != null) {
String destinationPath = "C:\\temp\\" + uploadFile.getFileName(); // Example path
try (InputStream input = uploadFile.getInputstream();
OutputStream output = new FileOutputStream(destinationPath)) {
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = input.read(buffer)) != -1) {
output.write(buffer, 0, bytesRead);
}
System.out.println("File uploaded to: " + destinationPath);
} catch (IOException e) {
System.err.println("Upload failed: " + e.getMessage());
}
}
return null; // stay on the same page
}
}
Faces-config:
<managed-bean>
<managed-bean-name>fileUploadClass</managed-bean-name>
<managed-bean-class>sailpoint.services.standard.fileUpload.FileUploadClass</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<description>fileUpload</description>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>FileUploadClass</from-outcome>
<to-view-id>/workitem/fileUpload.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
Screenshot:
1.