Why am I getting this 404 error from Tomcat?

Posted on 2008-06-10
Last Modified: 2013-11-23
I am writing a simple JSP to calculate the distance between 2 points.  When I click on the "Submit" button, I get the following HTTP 404 error:

HTTP Status 404 - /distanceCalc/distanceCalculator.jsp%20method=


type Status report

message /distanceCalc/distanceCalculator.jsp%20method=

description The requested resource (/distanceCalc/distanceCalculator.jsp%20method=) is not available.


Apache Tomcat/6.0.16

What am I missing here?  Thank you in advance!
<%@ page import="java.lang.Math.*" %>



<head><title>JSP Distance Calculator</title><head>


	<h1>Distance Calculator</h1>


		String x1 = request.getParameter( "x1" );

		String y1 = request.getParameter( "y1" );

		String x2 = request.getParameter( "x2" );

		String y2 = request.getParameter( "y2" );


		if( ( x1 != null ) && ( y1 != null ) && 

			 ( x2 != null ) && ( y2 != null ) )




				Double.valueOf( x1 ).doubleValue( );

				Double.valueOf( y1 ).doubleValue( );

				Double.valueOf( x2 ).doubleValue( );

				Double.valueOf( y2 ).doubleValue( );			




				<font size="3" face="Verdana">

				<p>X1 is <%= x1 %></p>

				<p>Y1 is <%= y1 %></p>

				<p>X2 is <%= x2 %></p>

				<p>Y2 is <%= y2 %></p>


				<p>The distance between (X1, Y1) and (X2, Y2) is

					<%= Math.sqrt( ( Double.parseDouble( x1 ) - Double.parseDouble( x2 ) ) *

						          ( Double.parseDouble( x1 ) - Double.parseDouble( x2 ) ) + 

						          ( Double.parseDouble( y1 ) - Double.parseDouble( y2 ) ) *

						          ( Double.parseDouble( y1 ) - Double.parseDouble( y2 ) ) ) %>




				<hr />



			catch( Exception e )





				<font size="3" face="Verdana" color="red">

				<p>Please complete all fields</p>


				<hr />





		<form action="distanceCalculator.jsp method="post">


			<p>Please enter the value of X1:

				<input type="text" name="x1" length="7"/>



			<p>Please enter the value of Y1:

				<input type="text" name="y1" length="7"/>



			<p>Please enter the value of X2:

				<input type="text" name="x2" length="7"/>



			<p>Please enter the value of Y2:

				<input type="text" name="y2" length="7"/>




				<input type="submit" value="Submit"/>





Open in new window

Question by:CharleneS77
LVL 20

Accepted Solution

gatorvip earned 500 total points
Comment Utility
You're missing quotes after distanceCalculator.jsp  in
<form action="distanceCalculator.jsp method="post">

Author Closing Comment

Comment Utility
Thank you!

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoresSpecial  challenge 13 40
IT Company 5 67
countAbc challenge 9 49
ArrayLists in ArrayLists/HashMaps? 4 38
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now