1

I have a legacy Struts 2 application configured as a dynamic web application in Eclipse that pre-compiles JSPs and puts them under WEB-INF/classes/org.

They are mapped in web.xml as as servlets.

I tried removing the mapping of the servlets in web.xml so I can normally just use the JSPs but when I try to access the following urls:

  • http://localhost:8080/jsp/index.jsp
  • http://localhost:8080/index.jsp

I get this error:

The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

<servlet>
        <servlet-name>org.apache.jsp.index_jsp</servlet-name>
        <servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>

The struts.xml maps the JSP below which looks correct:

<action name="index" class="com.acr.cs.action.ClassforGreat" method="index">
        <result>/jsp/index.jsp</result>
</action>

The structure of my project below

WebContent
-images
-jsp
-WEB-INF

How to make me use just the jsps and remove the pre-compiled ones?

Roman C
  • 49,761
  • 33
  • 66
  • 176

1 Answers1

0

Just use JSPs under WEB-INF and create a result configs.

You don't have to access JSPs directly from the browser because they are not resources and in most cases can't run without associated filter.

They are used as a templates for generating HTML returned as a resource from the action after executing it.

Roman C
  • 49,761
  • 33
  • 66
  • 176