Solved

Why am I getting this 404 error from Tomcat?

Posted on 2008-06-10
2
449 Views
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.*" %>
 
<html>
<head><title>JSP Distance Calculator</title><head>
<body>
	<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 ) )
		{
			try
			{				
				Double.valueOf( x1 ).doubleValue( );
				Double.valueOf( y1 ).doubleValue( );
				Double.valueOf( x2 ).doubleValue( );
				Double.valueOf( y2 ).doubleValue( );			
	%>
				<h2>Output</h2>
				
				<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 ) ) ) %>
				</p>
				</font>
				
				<hr />
			<%
			}
			catch( Exception e )
			{
			%>
				<h2>Error</h2>
				
				<font size="3" face="Verdana" color="red">
				<p>Please complete all fields</p>
				</font>
				<hr />
		<%
			}
		}
		%>
		<form action="distanceCalculator.jsp method="post">
		
			<p>Please enter the value of X1:
				<input type="text" name="x1" length="7"/>
			</p>
			
			<p>Please enter the value of Y1:
				<input type="text" name="y1" length="7"/>
			</p>
			
			<p>Please enter the value of X2:
				<input type="text" name="x2" length="7"/>
			</p>
			
			<p>Please enter the value of Y2:
				<input type="text" name="y2" length="7"/>
			</p>
			
			<p>
				<input type="submit" value="Submit"/>
			</p>
		</form>
	</body>
</html>

Open in new window

0
Comment
Question by:CharleneS77
[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
2 Comments
 
LVL 20

Accepted Solution

by:
gatorvip earned 500 total points
ID: 21754376
You're missing quotes after distanceCalculator.jsp  in
<form action="distanceCalculator.jsp method="post">
0
 

Author Closing Comment

by:CharleneS77
ID: 31465890
Thank you!
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
designing in object programming 12 109
check java version using powershell 13 305
ejb entity bean example issue 2 27
Notify sent to other threads in Java 9 43
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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 will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

726 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