Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp code wont run

 
andrew bliss
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Tomcat/Apache. I have installed Tomcat, and I have written a simple jsp page.

<HTML>
<BODY>
Hello! The time is now <%= new java.util.Date() %>
</BODY>
</HTML>

But that is how it renders in the browser. How do I make apache/tomcat run the jsp?
 
Aum Tao
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by andrew bliss:
I am new to Tomcat/Apache. I have installed Tomcat, and I have written a simple jsp page.

<HTML>
<BODY>
Hello! The time is now <%= new java.util.Date() %>
</BODY>
</HTML>

But that is how it renders in the browser. How do I make apache/tomcat run the jsp?

This is due to the fact that your code is not being interpreted by the JSP engine. Did you place the jsp file in the webapps/ROOT/ directory? And, have you started the tomcat server? This can be tested by entering http://localhost:8080/ in your browser.
 
andrew bliss
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I probably should have given more detail. So my friend has a ubuntu server that is running two websites on it. His and mine. He said that the localhost:8080 worked and that it showed up with the tomcat page. But when I access it on the web it shows up like normal text. And he is busy at work so I can't really see what his localhost:8080 is doing.
 
Aum Tao
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by andrew bliss:
And he is busy at work so I can't really see what his localhost:8080 is doing.

It's a little unclear from your post to know if you have physical access to your friend's ubuntu server. The localhost will not work from the web. You have to know the website's domain name too.
 
andrew bliss
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have physical access to the server.
 
Aum Tao
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am afraid the "localhost:8080" won't work unless you are accessing the server remotely through VNC or some other software. You will need the hostname/IP to access the website.
 
andrew bliss
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can access the server remotely but I only have access to a shell and not a gui. I was just wondering why the jsp wouldn't run when I access the website on the internet.
 
Aum Tao
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can get the IP address of the remote machine with ifconfig -a and use the ip-address:8080 instead of the localhost:8080. I am assuming that both the computers are in the same network, and hence recognize each other.
 
andrew bliss
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our computers are not on the same network.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a checklist
1. How do you access your JSP that is present on your friend's PC.
This hardly matters how the concern is you can access it.

2. your JSP has a .jsp extension.
Currently it might be .htm or .html so it is rendered as plain text.

3. When you get the Tomcat homepage, you are able to browse through the JSP Examples.
 
andrew bliss
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I type in his internet site. http://www.totallyghettogames.com/test/test.jsp

2. It does have a jsp extension

3. I don't have access to the tomcat page, I only have access to a remote shell to his server, but he says that it does come up with the tomcat page
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that the "test" directory is configured as a web application with a WEB-INF sub-directory and web.xml deployment descriptor?

Bill
 
andrew bliss
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I check that?
 
andrew bliss
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok so I have learned a little more about this. I have gotten it to work on the localhost:8080. But my main question is how do I get it to work with a website. My website is http://www.hitlessons.com/test/test.jsp So I have looked at the mod_jk connector. But from looking at the documentation I am not sure how to use it. Apache is using virtual hosting so this website is one of many. Do I need to edit the apache conf file and make a worker or something to forward jsp requests to tomcat? I am really not sure what to do. Thanks for the help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic