Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Apache Tomcat and jsp

Posted on 2006-06-29
3
510 Views
Last Modified: 2010-04-01
Hi all

I installed the following:

JavaTM 2 Platform Standard Edition
Development Kit 5.0

I then installed Apache Tomcat 5.x

I also loaded the Apache JDK 1.4 Compatability Package

I got some java servlets up and running ok.  I can invoke them from a html page.

Now I want to run jsp pages.

I have a simple html page with the following line:

<form id="form2" method="get" action="simple.jsp">

The simple.jsp is as follows:

<html>
<head>
<title>Simple JSP Page</title>
</head>
<body>
<h2>Request Origin</h2>
Host Name: <%= request.getRemoteHost() %>
<br>
IP Address: <%= request.getRemoteAddr() %>
</body>
</html>

When I submit the form to call this jsp page, the browser wants to open the actual jsp file in an editor, rather than invoking it.

I guess apache is not responding to this request.

When I look at /conf/web.xml fine in apache it does include the following:

    <!-- The mapping for the JSP servlet -->
    <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>

Can anyone tell me where I am going wrong?

Thanks, Phil

0
Comment
Question by:pmccar06
3 Comments
 
LVL 3

Accepted Solution

by:
runa_paathak earned 125 total points
ID: 17008949
Forget about conf/web.xml, that is not relevant to your problem.

Create a folder like "myapp" in Tomcat's webapps folder. Place your html file and jsp file in this folder. Start tomcat; once tomcat server is up and running, access the html page with a url like this:

http://localhost:8080/myapp/yourhtmlpage.html.

The broswer is opening the jsp directly because you are not running Tomcat server and you don't have your webapp set up properly.
0
 
LVL 27

Expert Comment

by:rrz
ID: 17009325
>I also loaded the Apache JDK 1.4 Compatability Package  
Why did you do that ?   Don't use it. You are using java 5 and it is not for you.  
><form id="form2" method="get" action="simple.jsp">  
change to  
<form id="form2" method="get" action="http://localhost:8080/yourWebAppName/simple.jsp">
I have assumed that you left the default port 8080 and you have placed  simple.jsp into the root directory of your web app.


0
 
LVL 35

Expert Comment

by:TimYates
ID: 17016306
I wouldn't do that to the form tag :-/
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to reset your Windows 10 password when you've forgotten it.
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question