Search code examples
jsfjakarta-eefile-uploadjsf-2tomahawk

"http://myfaces.apache.org/tomahawk" Not found. Error in JSF


I want to upload an Excel file to a JBoss Server with JSF, so I used Tomahawk.

<%@ taglib uri="http:// myfaces.apache.org/tomahawk" prefix="t" %> 

<h:form id="MF" enctype="multipart/form-data" > 
<t:inputFileUpload id="fileupload" value="#{dataentryctl.minvoice}" storage="file" required="false" /> 
<h:commandButton id="Submit" type="button" action="#{dataentryctl.ProcessData}" value="save" 
onclick="revalidateF12();submitForm()" onkeydown="keyDownEvents(this)" /> 
</h:form> 

I have the following JARs:

tomahawk-1.1.9.jar 
commons-el-1.0.jar 
commons-logging-1.1.1.jar 
commons-fileupload-1.2.2-javadoc.jar 
commons-io-1.4.jar 

Other JARs related to JSF are already there. Other JSP pages work fine.

I have Add in web.xml also ( i am not getting any error in starting jBoss Server)

<filter> 
<filter-name>extensionsFilter</filter-name> 
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class> 
<init-param> 
<description> ... </description><param-name>uploadMaxFileSize</param-name> 
<param-value>100m</param-value> 
</init-param> 
<init-param> 
<description> ...</description> 
<param-name>uploadThresholdSize</param-name> 
<param-value>100k</param-value> 
</init-param> 
</filter> 
<filter-mapping> 
<filter-name>extensionsFilter</filter-name><url-pattern>.jsf</url-pattern> 
</filter-mapping> 
<filter-mapping> 
<filter-name>extensionsFilter</filter-name><url-pattern>/faces/</url-pattern> 
</filter-mapping> 

Action Class package panaceaFACweb.FACCtlbean;

import org.apache.myfaces.custom.fileupload.UploadedFile; 
import javax.servlet.http.HttpSession; 
import java.io.IOException; 
import java.io.InputStream; 
import java.io.InputStreamReader; 

public class dataentryctl { 

private UploadedFile minvoice; 

public UploadedFile getMinvoice() { 
return minvoice; 
} 

public void setMinvoice(UploadedFile minvoice) { 
this.minvoice = minvoice; 
} 

public String ProcessData() { 
load(); 
return null; 
} 

public void load() { 

try { 
InputStream input = minvoice.getInputStream(); 
// ... 
} catch (IOException e) { 
e.printStackTrace(); 
}catch (Exception e) { 
e.printStackTrace(); 
} 
} 
} 

Kindly Help me to fix it i am try for more than a week :(


Solution

  • Here,

    <%@ taglib uri="http:// myfaces.apache.org/tomahawk" prefix="t" %> 
    

    you have a dangling space after the scheme in the taglib URI. Remove it:

    <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %> 
    

    Unrelated to the concrete problem, the URL pattern of the filter mappings of the extensions filter are wrong. You should use *.jsf and /faces/*. Or, better, just map it on the servlet name of the FacesServlet directly.