2012-11-15 25 views
0

我想用JSF將Excel文件上傳到JBoss服務器,所以我使用了Tomahawk。「http://myfaces.apache.org/tomahawk」未找到。 JSF中的錯誤

<%@ 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> 

我有以下JAR文件:

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 

有關JSF其他JAR已經在那裏了。其他JSP頁面正常工作。

我添加在web.xml中也(我沒有得到任何錯誤啓動JBoss服務器)

<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類 包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(); 
} 
} 
} 

請幫助我解決它,我正在嘗試一個多星期:(

回答

0

這裏更多,

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

你在的taglib URI方案後懸掛空間。刪除它:

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

無關對於具體問題,擴展過濾器的過濾器映射的URL模式是錯誤的。您應該使用*.jsf/faces/*。或者,最好直接將其映射到FacesServlet的servlet名稱上。