1

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?

Shog9
  • 156,901
  • 35
  • 231
  • 235
Gary Kephart
  • 4,860
  • 5
  • 39
  • 52
  • Where are those files ? What do you get trying accessing them, 404 ? – Andrea Ligios Oct 29 '15 at 09:25
  • You shouldn't have to do anything: "The result type is based on the extension of the file. The supported extensions are: jsp,ftl,vm,html,html."(sic) https://struts.apache.org/docs/convention-plugin.html If it is public javadoc you could also move it into a publicly accessible location. Note: seems they wrote html twice when it should be htm and html of course. – Quaternion Oct 29 '15 at 18:00
  • But the two don't have the same conventions, javadoc uses CamelCase names and conventions likes "-". Someone else can experiment... what have you tried, and what are the results? – Quaternion Oct 29 '15 at 18:15
  • I've provided more information above. – Gary Kephart Nov 05 '15 at 21:44

1 Answers1

1

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.

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
  • So a better practice would be to place those files at the top level and not under WEB-INF/content? The convention plugin does not manage any of the files that are not under WEB-INF/content? – Gary Kephart Nov 09 '15 at 19:59
  • Files under web-inf cannot be accessed directly, S2 convention plugin is irrelevant. – Aleksandr M Nov 10 '15 at 08:59