Page 1 of 1

Xampp, Tomcat, jsp pages show source code [Answered]

PostPosted: 22. August 2012 05:28
by MintDarkGoblin
Hello I am using Tomcat with Xampp 1.8 (control panel version 3.0.12) to serve .jsp pages but the browser (Firefox 14) show the source code on the served page when it is in the xampp/tomcat/webapps folder. If I move the .jsp file to the xampp/webapps/examples folder the .jsp works. Why? By the way what is a WEB-INF folder? I am using Windows 7 operating system.

Code: Select all
<%@page contentType="text/html" import="java.util.*" %>
<HTML>
 <HEAD>
  <TITLE>Hello World</TITLE>
 </HEAD>
 <BODY>
  <H1>Hello World</H1>
  Today is: <%= new java.util.Date() %>
 </BODY>
</HTML>

Re: Xampp, Tomcat, jsp pages show source code

PostPosted: 22. August 2012 14:31
by JonB
OK - I am NOT expert with Tomcat, but I think I can explain

Apache acts as a proxy for Tomcat so that things can run over port 80. Tomcat is an app server primarily, not a webserver. I.e. Apache is an output device/stream for Tomcat. (think about how Java is a sandbox/walled garden that runs locally - in this case on your server) I need my pile of stones (therefore) - what is in the Tomcat server folder is local to that instance of tomcat. You probably could address those objects over a port configured for tomcat, I think 8080 is the one used.

If you look in httpd.conf you will find this lime:

Include "conf/extra/httpd-ajp.conf"

Look in that file to see how it works.

This has a good explanation:
http://www.roseindia.net/servlets/tomcat-server.shtml

I hope that helps explain it.
8)

Re: Xampp, Tomcat, jsp pages show source code

PostPosted: 23. August 2012 17:27
by MintDarkGoblin
Thank for the information it clears up a lot of confusion.