[jboss-user] [JBoss Seam] - Re: s:fileUpload+trinidad = no Renderer for component family
javabr
do-not-reply at jboss.com
Fri Jun 8 17:07:54 EDT 2007
Guys,
I simply can not get it working... please HELLLLLLLP ME..
from my code:
| <h:form id="task" styleClass="edit" enctype="multipart/form-data">
| ...
| <s:decorate id="fileToUploadDecoration">
| <s:fileUpload id="fileToUpload" style="size:60" accept=""
| data="#{fileHome.filedata}" fileName="#{fileHome.filename}"
| readonly="#{readonly}" />
| </s:decorate>
|
components.xml
| <web:multipart-filter create-temp-files="true"
| max-request-size="1000000" url-pattern="*.seam" />
|
from log, lots and lots of: (when i submit the form)
| 18:03:42,093 ERROR [STDERR] 08/06/2007 18:03:42 org.apache.myfaces.trinidadinternal.renderkit.RenderKitBase getRenderer
| WARNING: Renderer 'javax.faces.Text' not found for component family 'org.jboss.seam.ui.FileUpload'
|
My Bean:
| package org.bit.etask.home;
|
| import static javax.faces.application.FacesMessage.SEVERITY_INFO;
|
| import java.io.IOException;
| import java.util.ArrayList;
| import java.util.List;
|
| import org.bit.etask.AbstractEntityHome;
| import org.bit.etask.Authenticator;
| import org.bit.etask.Constants;
| import org.bit.etask.FileHelper;
| import org.bit.etask.domain.Activity;
| import org.bit.etask.domain.File;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
|
| @Name("fileHome")
| public class FileHome extends AbstractEntityHome<File> {
|
| private byte[] filedata;
|
| private String filename;
|
| private String fileUploadFrom;
|
| @In(create = true)
| Authenticator authenticator;
|
| @In(create = true)
| TaskHome taskHome;
|
| private List<File> files = new ArrayList<File>(0);
|
| public TaskHome getTaskHome() {
| return taskHome;
| }
|
| public void setTaskHome(TaskHome taskHome) {
| this.taskHome = taskHome;
| }
|
| public void setFileId(Integer id) {
| setId(id);
| }
|
| public Integer getFileId() {
| return (Integer) getId();
| }
|
| @Override
| protected File createInstance() {
| File file = new File();
| return file;
| }
|
| public File getDefinedInstance() {
| return isIdDefined() ? getInstance() : null;
| }
|
| public String uploadThis() {
| //FILE NAME AND FILEDATA ARE NULL EVERYTIME
|
| if (getFilename() == null
| || getFilename().equals("")
| || getInstance().getDescription() == null
| || getInstance().getDescription().equals("")) {
| return Constants.ERROR;
| }
|
| File file = new File();
| file.setFilename(FileHelper.getJustFileName(getFilename()));
| file.setDescription(getInstance().getDescription());
| file.setFiledata(getFiledata());
| files.add(file);
| getInstance().setDescription(null);
| try {
| FileHelper.saveFile(file, taskHome, authenticator.getLoggedActor());
| } catch (IOException e) {
| getFacesMessages().addFromResourceBundleOrDefault(SEVERITY_INFO, getMessageKeyPrefix() + "_upload",
| "Error uploading file: #0", e.getMessage());
| return Constants.ERROR;
| }
| return Constants.SUCCESS;
| }
|
| public String uploadIsDone() {
| if (FileHelper.isFromTaskEdit()) {
| taskHome.getInstance().getCurrentActivity().getFiles().clear();
| taskHome.getInstance().getCurrentActivity().getFiles().addAll(files);
| return "backToTaskEdit";
| } else {
| return "backToActorEdit";
| }
| }
|
| public String getFileUrl() {
| Activity activity = taskHome.getInstance().getCurrentActivity();
| String server = "../etask_uploaded/";
| String url = FileHelper.getUrlPath(activity.getActor(), taskHome);
| return server + url;
| }
|
| public void deattach(File file) {
| getFiles().remove(file);
| FileHelper.removeFile(file, taskHome, authenticator.getLoggedActor());
| if (FileHelper.isFromTaskEdit()) {
| taskHome.getInstance().getCurrentActivity().getFiles().clear();
| taskHome.getInstance().getCurrentActivity().getFiles().addAll(getFiles());
| }
| }
|
| public byte[] getFiledata() {
| return filedata;
| }
|
| public void setFiledata(byte[] filedata) {
| this.filedata = filedata;
| }
|
| public String getFilename() {
| return filename;
| }
|
| public void setFilename(String filename) {
| this.filename = filename;
| }
|
|
|
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4052749#4052749
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4052749
More information about the jboss-user
mailing list