2012-04-06 88 views
0

我在Struts2中顯示一些圖像時遇到了一些麻煩。當加載有從數據庫中圖像的頁面,例如:在Struts2中沒有爲名稱空間/和動作名稱userfiles/images /映射的操作

<img src="userfiles/images/${imageName}" width="200px"/>

<img src="userfiles/images/<s:property value="imageName"/>" width="200px"/>

我不斷收到這個奇怪的錯誤,告訴我,有沒有這樣的行動的路徑userfiles/images/。有什麼問題?

過濾器配置:

<filter> 
    <filter-name>struts2</filter-name> 
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> 
</filter> 
<filter-mapping> 
    <filter-name>struts2</filter-name> 
    <url-pattern>/*</url-pattern> 
    <dispatcher>FORWARD</dispatcher> 
    <dispatcher>REQUEST</dispatcher> 
</filter-mapping> 

例外:

There is no Action mapped for namespace/and action name userfiles/images/. - [unknown location] 
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189) 
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) 
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) 
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) 
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) 
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) 
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at com.estudii.filters.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:22) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) 
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) 
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405) 
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964) 
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515) 
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
at java.lang.Thread.run(Thread.java:722) 
+0

提供詳細說明如何你正在訪問的行動?和與此操作相關的struts.xml。 – 2012-04-06 16:27:44

+0

我沒有接觸到這個動作,請重讀這個問題 – Denees 2012-04-06 16:50:12

+0

<s:property value =「%{equipment.receiverModel}」/>我寫過這樣的圖片標籤,它從未尋找行動。 – 2012-04-06 19:32:18

回答

相關問題