Solved

Apache Tomcat and jsp

Posted on 2006-06-29
3
515 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
[X]
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
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

Suggested Solutions

Title # Comments Views Activity
Export JSON response data to Excel in IE9 3 90
J2SE 5.0 metadata 1 67
EJB MDB example 4 89
null output 3 42
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

756 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