title: Struts cannot access jsp from jsp directory
body: <p>I have a <strong>Struts2</strong> application initially the <strong>jsp</strong> pages were at the root of the <code>WebContent</code> directory however it was decided to add a <strong>jsp</strong> directory to hold the <strong>jsp pages</strong>. </p>
  
  <p>Since this has been done the pages are not accessible and resulted in <strong>HTTP 404 error</strong>. I am able to access the welcome file <code>/jsp/index.jsp</code>. However when i post the index page i get <code>HTTP 404 error -  /SEP/hello</code>. </p>
  
  <p>I know the code works since once the jsp pages are at the root of the <code>WebContent</code> directory it works. I would like to know how can i configure the application to utilize the jsp directory for accessing jsp pages. Under is a screen shot of the directory structure and relevant code:</p>
  
  <p><strong>Project Structure</strong></p>
  
  <p><img src="https://i.stack.imgur.com/WduxC.jpg" alt="Project Structure"></p>
  
  <p><strong>struts.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE struts PUBLIC
     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
     "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;
  &lt;struts&gt;
    &lt;constant name="struts.devMode" value="true" /&gt;
     &lt;package name="default" namespace="/jsp/" extends="struts-default"&gt;
  
        &lt;action name="hello" 
              class="org.xxxx.product.registration.model.HelloWorldAction" 
              method="execute"&gt;
              &lt;result name="success"&gt;/HelloWorld.jsp&lt;/result&gt;
  
        &lt;/action&gt;
     &lt;/package&gt;
  &lt;/struts&gt;
  </code></pre>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns="http://java.sun.com/xml/ns/javaee" 
  xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"&gt;
  
   &lt;display-name&gt;Struts 2&lt;/display-name&gt;
     &lt;welcome-file-list&gt;
        &lt;welcome-file&gt;/jsp/index.jsp&lt;/welcome-file&gt;
     &lt;/welcome-file-list&gt;
  
  
     &lt;filter&gt;
        &lt;filter-name&gt;struts2&lt;/filter-name&gt;
        &lt;filter-class&gt;
              org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
        &lt;/filter-class&gt;
     &lt;/filter&gt;
  
     &lt;filter-mapping&gt;
        &lt;filter-name&gt;struts2&lt;/filter-name&gt;
        &lt;url-pattern&gt;/jsp/*&lt;/url-pattern&gt;
     &lt;/filter-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>index.jsp</strong></p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;%@taglib prefix="s" uri="/struts-tags"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;title&gt;Hello World&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Hello world From Struts2 BY D.Ramdhanie&lt;/h1&gt;
      &lt;form action="hello"&gt;
          &lt;label for="name"&gt;Please enter your name&lt;/label&gt;&lt;br/&gt;
          &lt;input type="text" name="name"/&gt;
          &lt;input type="submit" value="Say Hello"/&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>HelloWorld.jsp</strong></p>
  
  <pre><code>&lt;%@ page contentType="text/html; charset=UTF-8" %&gt;
  &lt;%@taglib prefix="s" uri="/struts-tags"%&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Hello World&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
     Hello World, &lt;s:property value="name"/&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>