Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Apache Tomcat and jsp

Posted on 2006-06-29
3
Medium Priority
?
529 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 500 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 28

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Whoever said that “a picture is worth one thousand words” observed a fact that can dramatically affect your marketing success. Most people tend to learn visually, so many publishers commonly acknowledge the effectiveness of visual learning by using…
In this article, I’ll show how research, determination, and use of modern technology helped me solve a DNA mystery.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

722 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