Forum Stats

  • 3,872,508 Users
  • 2,266,437 Discussions


JSP application Error 404: The server has not found anything matching the R

Running Win Server 2008 64 bit. Using JDev Studio Edition Version

I'm writing a test application which gives the user an interface to write custom queries. The application cosists of two Java classes, a jsp page and web.xml. I run the application on the integrated WLS in J dev. The jsp page displays fine, but when I press the <EXECUTE> button I get ' Error 404--Not Found - The server has not found anything matching the Request-URI' . Any advice would be greatly appreciated. Following is the contents of the application:

<?xml version = '1.0' encoding = 'windows-1252'?>
<web-app xmlns:xsi=""
version="2.5" xmlns="">



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<%@ page contentType="text/html;charset=windows-1252"%>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>

<%@ taglib uri="" prefix="c"%>
<c:if test="${sqlStatement == null}">
<c:set var="sqlStatement" value="select * from User" />

manaar SQL Gateway
Enter a SQL statement and press the execute button

SQL Statement:
<form action="sqlGateway" method="post">
<textarea name="sqlStatement" cols="60" rows="8">${sqlStatement}

<input type="submit" value="Execute">

SQL Result:





package mmv2;


import javax.servlet.*;
import javax.servlet.http.*;

import java.sql.*;

public class SqlGatewayServlet extends HttpServlet {
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
String sqlStatement = request.getParameter("sqlStatement");
String sqlResult = "";

try {
// get a connection
String dbURL = "jdbc:mysql://<server>/*******";
String username = "root";
String password = "**********";
Connection connection =
DriverManager.getConnection(dbURL, username, password);

// create a statement
Statement statement = connection.createStatement();

// parse the SQL string
sqlStatement = sqlStatement.trim();
if (sqlStatement.length() >= 6) {
String sqlType = sqlStatement.substring(0, 6);
if (sqlType.equalsIgnoreCase("select")) {
// create the HTML for the result set
ResultSet resultSet = statement.executeQuery(sqlStatement);
sqlResult = SQLUtil.getHtmlTable(resultSet);
} else {
int i = statement.executeUpdate(sqlStatement);
if (i == 0) // a DDL statement
sqlResult = "The statement executed successfully.";
else // an INSERT, UPDATE, or DELETE statement
sqlResult =
"The statement executed successfully.
" +
i + " row(s) affected.";
} catch (SQLException e) {
sqlResult =
"Error executing the SQL statement:
" + e.getMessage();

HttpSession session = request.getSession();
session.setAttribute("sqlResult", sqlResult);
session.setAttribute("sqlStatement", sqlStatement);

String url = "/sql_gateway.jsp";
RequestDispatcher dispatcher =
dispatcher.forward(request, response);
This discussion has been closed.