Note that there are some explanatory texts on larger screens.

plurals
  1. POJSP displaying source code instead of executing
    text
    copied!<p>I'm new to jsp and have ran into some trouble. Initially, the jsp file and associated java classes were built and tested fine on a test Tomcat server. Now, they've been transitioned to another server of what I believe is the same setup (except it's linux now instead of windows). But when the jsp page is accessed the source code is displayed instead of the jsp actually executing. I've googled for a while but received no success.</p> <p>Here is the code of the jsp file I am testing:</p> <pre><code>&lt;HTML&gt; &lt;BODY&gt; Hello! The time is now &lt;%= new java.util.Date() %&gt; &lt;/BODY&gt; &lt;/HTML&gt; </code></pre> <p>And here is what I see in my browser when navigating to the page: </p> <pre><code> Hello! The time is now &lt;%= new java.util.Date() %&gt; </code></pre> <p>The source of the page is the exact code that is typed in the example file:</p> <pre><code>&lt;HTML&gt; &lt;BODY&gt; Hello! The time is now &lt;%= new java.util.Date() %&gt; &lt;/BODY&gt; &lt;/HTML&gt; </code></pre> <p>The server appears to be working. Here are is the response headers I obtained from Firebug:</p> <pre><code>Date Sat, 15 Jan 2011 20:53:24 GMT Server Apache/2.2.3 (CentOS) Last-Modified Sat, 15 Jan 2011 02:20:18 GMT Etag "b385d8-55-499d931205c80" Accept-Ranges bytes Content-Length 85 Content-Type text/html; charset=UTF-8 </code></pre> <p>I had thought that <a href="http://www.coderanch.com/how-to/java/InvokerServlet" rel="noreferrer">this page</a> might solve the problem since there was no reference to the jsp file I was using or even the following snippets in my web.xml file in the WEB-INF folder:</p> <pre><code>&lt;servlet&gt; &lt;servlet-name&gt;jsp&lt;/servlet-name&gt; &lt;servlet-class&gt;org.apache.jasper.servlet.JspServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;logVerbosityLevel&lt;/param-name&gt; &lt;param-value&gt;WARNING&lt;/param-value&gt; &lt;/init-param&gt; &lt;load-on-startup&gt;3&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;jsp&lt;/servlet-name&gt; &lt;url-pattern&gt;*.jsp&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; </code></pre> <p>I tried inserting these lines and restarting Tomcat, but no success. Any ideas?</p>
 

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