Search code examples
javahtmljspstruts2struts2-convention-plugin

Struts2 does not find HTML files


I'm using Struts2 with the convention plugin. I know how to get it to find actionless JSP files, but I can't seem to get it to display actionless HTML files. I have a whole set of HTML files generated by javadoc which I want to display in my WAR file (which is the documentation WAR for the actual application).

I put all of the HTML files under WEB-INF/content. When I remove the .html from the links, the file is found, but I'm not going to do that for the hundreds of javadoc files.

How do I get it to display index.html, overview-summary.html, etc?


Solution

  • If you really need to access these files through action then you need to set html to be an action extension. Use struts.action.extension constant to do that.

    <constant name="struts.action.extension" value="action,html,htm,,"/>
    

    BUT if these files are static resources why do you want to access them through the actions in the first place? Take them out of WEB-INF and access them directly.