开发者

Public folder exploration under Struts2 web application

I want to publish some resources (folders and files) under a folder inside the WebContent folder of my Struts2 application and allow free directory exploration of that folder contents.

WebContent/public-folder/.

Does somebody know how to achieve this?

All my attempts fail with the classical ‘There is no Action mapped for action name public-folder’

I am using Sitemesh decorator, and have de开发者_开发知识库fined next exclude pattern:

<excludes>            
<pattern>/*public-folder*</pattern>
</excludes>                 

It seems that I’m unable to escape away from Struts2 control. Thanks…


Warning

There is no Action mapped for action name public-folder

because of /* for filter

<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>
</filter-mapping>

Solution

struts.xml (Preventing Struts 2 from Handling a Request)

<!-- value : regular expressions -->
<constant name="struts.action.excludePattern" value="/public-folder/.*?" />


[Tomcat] /conf/web.xml

<init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value> <!-- default is false -->
</init-param>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜