aspose file tools*
The moose likes Servlets and the fly likes 404 - The Requested Resource is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "404 - The Requested Resource is not available" Watch "404 - The Requested Resource is not available" New topic
Author

404 - The Requested Resource is not available

Dominic LeVasseur
Greenhorn

Joined: Nov 01, 2010
Posts: 3
Hi everyone, hope you can help. Not sure if this should be here or in IDEs, but I'll start here. I've been having a bit of rough time getting Netbeans, MySQL, and Tomcat set up on my new windows 7 64bit machine. Been having some strange problems like not being able to save files, but I think I've got it all straightened out. Now to the problem.

Background: Using Tomcat 6.0.33 (64bit) ; MySQL 5.5 (64bit) ; Netbeans 7.0.1 ; JDK 1.7.0 (64bit)
Basing my program off of Murach's JSP and Servlets book, which I think is quite good, btw.

I can run a servlet directly from the Netbeans UI, but when trying to run it from a JSP (by way of a form) I get a 404 - The requested resource is not available error. I've been searching around trying to find an answer, but I haven't been able to find anything that can help. Below is a snippet from the jsp that launches the servlet in question and the web.xml file. Can anyone help point me in the correct direction? I'm lost. Thanks. Hope the paste comes out formatted. Sorry for the length of the post.

<h3>Add new roster entry</h3>
<form action="<c:url value='/addNewSchedule' />">
<table cellpadding="5" border="0">
<tr>
<td><input type="hidden" name="idkids" value="${kid.id}"></td>
</tr>
<tr>
<td>Week:</td>
<td><input type="text" name="week"></td>
</tr>
<tr>
<td>Amount Paid:</td>
<td><input type="text" name="amountPaid"></td>
</tr>
<tr>
<td>All Paid:</td>
<td><select>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</td>
</tr>
<tr>
<td><input type="submit" value="Submit"></td>
</tr>
</table>
</form>

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>addNewKidServlet</servlet-name>
<servlet-class>camp.admin.addNewKidServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>displayKidServlet</servlet-name>
<servlet-class>camp.admin.displayKidServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>displayScheduleServlet</servlet-name>
<servlet-class>camp.admin.displayScheduleServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>addNewScheduleServlet</servlet-name>
<servlet-class>camp.admin.addNewScheduleServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>addNewKidServlet</servlet-name>
<url-pattern>/addNewKid</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>displayKidServlet</servlet-name>
<url-pattern>/displayKid</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>displayScheduleServlet</servlet-name>
<url-pattern>/displaySchedule</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>addNewScheduleServlet</servlet-name>
<url-pattern>/addNewSchedule</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

When you do a View Source in the browser, is the value of the form action attribute what you expect?

Can you invoke the servlet from the URL bar of the browser (assuming you have it set up to accepts GETs)?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dominic LeVasseur
Greenhorn

Joined: Nov 01, 2010
Posts: 3
Hi Bear, thanks for responding. Sorry about the code, I wanted it formatted, but wasn't sure how to do it, should have read the FAQ to be sure. I'll do better next time. To your questions:

Yes, the form action attribute is what I'd expect: <form action="<c:url value='/addNewSchedule' />">

Yes, typing directly into browser: http://localhost:8080/campScheduler/addNewSchedule runs the servlet.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

Yes, the form action attribute is what I'd expect: <form action="<c:url value='/addNewSchedule' />">

It is? Why would you expect the JSTL to not have been evaluated?

If that's what you are getting at the browser, then that's the problem. The JSTL should have been evaluated before the HTML was sent to the browser.
Dominic LeVasseur
Greenhorn

Joined: Nov 01, 2010
Posts: 3
Thanks Bear. That helps. Have the problem solved now.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

 
 
subject: 404 - The Requested Resource is not available