You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Elmekki, Mohammed A." <Mo...@saic.com> on 2013/04/16 22:47:33 UTC

JSP rendering problem

I am moderately experienced with tomcat/jsp/servlet web development with
earlier versions, I am currently using apache-tomcat-7.0.39. I have a
simple JSP (that I reduced to one line of code: <h1><%
out.println("Hello"); %></h1>) that I wanted to test but all browsers,
ie, Firefox and Chrome would only display the source code rather than
render the content. Naturally, I Googled the problem and could not get a
satisfactory answer/explanation. This is a simple app at this point with
no virtual servers and if apache is re-setting the document-type from
text/html to text/plain, I was not able to find a configuration setup to
prevent it from happening.

 

Thanks,

 

Mohammed El-Mekki


Re: JSP rendering problem

Posted by Mark Eggers <it...@yahoo.com>.
On 4/16/2013 1:47 PM, Elmekki, Mohammed A. wrote:
> I am moderately experienced with tomcat/jsp/servlet web development with
> earlier versions, I am currently using apache-tomcat-7.0.39. I have a
> simple JSP (that I reduced to one line of code: <h1><%
> out.println("Hello"); %></h1>) that I wanted to test but all browsers,
> ie, Firefox and Chrome would only display the source code rather than
> render the content. Naturally, I Googled the problem and could not get a
> satisfactory answer/explanation. This is a simple app at this point with
> no virtual servers and if apache is re-setting the document-type from
> text/html to text/plain, I was not able to find a configuration setup to
> prevent it from happening.
>
>
>
> Thanks,
>
>
>
> Mohammed El-Mekki
>
>

And of course this works exactly as it should - getting the string in 
the <h1> tags.

Here's the clue that your setup is not as simple as you claim it to be:

 > if apache is re-setting the document-type from
 > text/html to text/plain

It sounds like you have an Apache HTTPD server sitting in front of your 
Tomcat server. In addition, it sounds like you've set DocumentRoot of 
your Apache HTTPD server to be the same as CATALINA_BASE/webapps.

This is bad on multiple levels and guaranteed not to work as you expect 
without some work.

The above of course are all guesses based on seeing similar problems 
mentioned on this mailing list and your use of apache instead of Tomcat, 
and the word 'resetting'.

Go here (one of the archives of this mailing list):

http://markmail.org/list/org.apache.tomcat.user/

Search for this in the search box:

jsp source displayed

There are lots of hits. A better search will get you closer to the answer.

What happens when you browse to your one line JSP on the port that 
Tomcat is listening to (by default, port 8080)?

If the code works there as expected, then you have an Apache HTTPD - 
Apache Tomcat configuration issue.

If it fails when browsing to port 8080, download a fresh copy of Apache 
Tomcat from tomcat.apache.org, unpack it, TOUCH NOTHING, and copy your 
WAR file to the webapps directory. Start Apache Tomcat and browse to 
port 8080.

. . . . just my two cents.
/mde/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org