Dateiupload über JSF?

Status
Nicht offen für weitere Antworten.
G

Guest

Gast
Ich beschäftige mich gerade mit JSF. Mit <h:form> wird wie ich gelesen habe ein <form> - eingeleitet. Was mich allerdings wundert ist, wie bekommt man denn folgenden Ausdruck in JSF hin?

Code:
<form enctype="multipart/form-data" action="_URL_" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="30000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">

denn ich vermisse in <h:form> die Angabe von enctype="multipart/form-data". Oder hat jemand evtl. ein Link oder kleines Beispiel, wie man Dateiupload hinbekommt?

Danke
Sven
 
M

maki

Gast
Weclhe JSF Implementierung nutzt du?

Diese sollte eine Komponente anbieten zum hochladen.

Reinen HTMLCode schreibt man NICHT mehr in JSF.
 
G

Guest

Gast
maki hat gesagt.:
Weclhe JSF Implementierung nutzt du?

Diese sollte eine Komponente anbieten zum hochladen.

Reinen HTMLCode schreibt man NICHT mehr in JSF.
1. MyFace Core
2. Was meinst du mit HTML Code schreibt man nicht mehr in JSF?
 
M

maki

Gast
1. Dann nutze doch die inputFileUpload Komponente von Tomahawk.
2. So wie ich das sagte, man nutzt JSF Komponenten anstatt normalem HTML.
 
G

Guest

Gast
Hat jemand ein funktionierendes Beispiel oder ein Link zu einem Beispiel? Wenn ich inputFileUpload verwende erhalte ich Fehlermeldung, das die Datei Upload.face nicht existiert. tomhawk.jar befindet sich im LIB-Pfad. Ich verwende als Beispiel z.Zt.

upload.jsf
Code:
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
<html>
<head>
<title>t:inputFileUpload example</title>
</head>
<body>
<f:view>
  <h:form id="welcomeForm" enctype="multipart/form-data">
    <t:inputFileUpload id="fileupload" value="#{FileUploadForm.upFile}"
			 size="20" />


    <h:commandButton value="Load the file" action="#{FileUploadForm.upload}" />
    <t:outputText value="File Uploaded Successfully." 
		rendered="#{FileUploadForm.rendSuccess}" 
		style="color:green;font-weight:bold"/>
    <t:outputText value="Error in File Uploading." 
		rendered="#{FileUploadForm.rendFailure}" 
		style="color:red;font-weight:bold"/>
  </h:form>
</f:view>
</body>
</html>

von http://www.roseindia.net/jsf/apache-myfaces-tomahawk/tomahawk_inputFileUpload_tag.shtml
 
M

maki

Gast
Zeig doch mal deine ManagedBean und die gesamte Fehlermeldung.
 
Status
Nicht offen für weitere Antworten.

Ähnliche Java Themen

Neue Themen


Oben