seam fileupload
hacpro Jun 11, 2009 4:03 PMhello to all..
i'm trying since 2 days to config the seam file uplpoad...but it isnt working..
so my question is.. what for configurations should i do?? if i press the upload button i wil reach always to the else part in the java class..
THE JAVA CLASS
package ch.spectromedia.util;
import static org.jboss.seam.ScopeType.CONVERSATION;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@Scope(CONVERSATION)
@Name("register")
public class RegisterAction {
private byte[] picture;
public void uploadPicture() {
if (picture != null && picture.length > 0) {
System.out.println("Die grösse des Bildes" + picture.length);
}
else{
System.out.println("der else fall ist eingetroffen..wieso auch immer");
}
}
public byte[] getPicture() {
return picture;
}
public void setPicture(byte[] picture) {
this.picture = picture;
}
}
THE JSF PART..
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
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:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
template="/layout/mee_template.xhtml">
<ui:define name="body">
<h:form styleClass="register" enctype="multipart/form-data">
<div class="formRow"><h:outputLabel for="picture">Member photo</h:outputLabel>
<s:fileUpload id="picture" data="#{register.picture}"
accept="image/jpg" />
<div class="validationError"><h:message for="picture" /></div>
</div>
<div class="buttons"><h:commandButton value="Upload"
action="#{register.uploadPicture}" styleClass="registerButton" /></div>
</h:form>
</ui:define>
</ui:composition>