2

I have two JSP files in the same folder on a java webapp. Let's call them index.jsp and myInclude.jsp. I want to include myInclude.jsp inside index.jsp. The webapp is not being served in the ROOT uri, but out of a separate webapp (such as /adminWebapp/).

In index.jsp, I have the following:

<s:include value="myInclude.jsp" />

When I try to access index.jsp, Struts throws the following exception:

Exception thrown during include of myInclude.jsp
java.io.FileNotFoundException: /myInclude.jsp

The trouble is that Struts 2's include tag added a "/" in front of the URL to the included file. If Struts 2 wants to use an absolute path (instead of relative), it would need to call /adminWebapp/myInclude.jsp. Is there any option which could fix the s:include tag? I'm hoping to avoid hard-coding the /adminWebapp into the link in case we ever move the webapp.

Roman C
  • 49,761
  • 33
  • 66
  • 176
David
  • 299
  • 2
  • 6
  • 16

1 Answers1

1

Try it with include directive

<%@ include file = "xxx" %>
Tom11
  • 2,419
  • 8
  • 30
  • 56
Muhammad Imran Tariq
  • 22,654
  • 47
  • 125
  • 190