Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That's not a problem. That's expected behaviour. You're just misunderstanding how the basic Servlet API works. You have configured the JSF-standard <code>FacesServlet</code> to listen on URLs matching <code>/faces/*</code> and you have configured Apache MyFaces specific <code>MyFacesServlet</code> to listen on URls matching <code>*.jsf</code> and <code>*.faces</code>.</p> <p>To get JSF to run, you have to open the page in browser by an URL which matches the mapping of the <code>FacesServlet</code>. Given the fact that you've an <code>index.jsp</code> file and that your context path is <code>Graph</code> and that you have configured two JSF servlets on three different URL patterns, you can open the JSP by the following URLs:</p> <ul> <li><a href="http://localhost:8080/Graph/faces/index.jsp">http://localhost:8080/Graph/faces/index.jsp</a> (invokes <code>FacesServlet</code>)</li> <li><a href="http://localhost:8080/Graph/index.jsf">http://localhost:8080/Graph/index.jsf</a> (invokes <code>MyFacesServlet</code>)</li> <li><a href="http://localhost:8080/Graph/index.faces">http://localhost:8080/Graph/index.faces</a> (invokes <code>MyFacesServlet</code>)</li> </ul> <hr> <p>Said that, your configuration is unnecessarily overcomplicated. Get rid of the <code>MyFacesServlet</code> entry and all of its associated URL mappings (with the servlet name of <code>faces</code>). Just stick to the standard <code>FacesServlet</code> and use its mapping instead, or alter it instead. I personally recommend using <code>*.jsf</code>.</p> <pre><code>&lt;servlet&gt; &lt;servlet-name&gt;facesServlet&lt;/servlet-name&gt; &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;facesServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; </code></pre> <p>Then you can just open the page by <a href="http://localhost:8080/Graph/index.jsf">http://localhost:8080/Graph/index.jsf</a>.</p> <hr> <p>Unrelated to the concrete problem, your <code>welcome-file</code> won't work that way. Tomcat would give a HTTP 404 error on that (page/resource not found). You need to specify <code>index.jsf</code> as <code>welcome-file</code> and supply a concrete but <strong>empty</strong> <code>index.jsf</code> file in the same folder as your <code>index.jsp</code>. This way Tomcat will be fooled that the file exist and show the page by just calling <a href="http://localhost:8080/Graph">http://localhost:8080/Graph</a>.</p> <hr> <p>If your concern is that it is possible to open JSF pages by their <code>*.jsp</code> extension which would result in a <code>RuntimeException: FacesContext not found</code> and you have actually no one JSP file which is to be served plain vanilla, then you can restrict direct access to JSP files by the following security constraint in <code>web.xml</code>:</p> <pre><code>&lt;security-constraint&gt; &lt;display-name&gt;Restrict direct access to JSP files&lt;/display-name&gt; &lt;web-resource-collection&gt; &lt;web-resource-name&gt;JSP files&lt;/web-resource-name&gt; &lt;url-pattern&gt;*.jsp&lt;/url-pattern&gt; &lt;/web-resource-collection&gt; &lt;auth-constraint /&gt; &lt;/security-constraint&gt; </code></pre> <p><em>(in JSF 2.0 this is by the way not needed anymore, with the default view technology Facelets it's possible to map the <code>FacesServlet</code> on just <code>*.xhtml</code>, which is the same as the default extension of Facelets files)</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload