Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet java http 404 status error
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


somu
java http 404 status error
1 Answer(s)      4 years and 9 months ago
Posted in : JSP-Servlet


I have tried to call a servlet from html page.. but it is showing http 404 status error..
and the description is "The requested resource is not available".

I hav tried in all ways.. Plz give me the solution..

Thank you..

Advertisement
View Answers

March 11, 2010 at 2:39 PM


Hi Friend,

Put your html file in web application folder and servlet in classes folder of apache tomcat. The web application folder should be under webapps folder of apache tomcat. Here examples is our web application folder.

1)index.html:

<HTML>
<FORM method="post" action="http://localhost:8080/examples/ServletExample">;
<TABLE>
<TR><TD>Name:</TD><TD><input type="text" name="name"></TD></TR>
<TR><TD>Address:</TD><TD><input type="text" name="address"></TD></TR>
<TR><TD><input type="submit" name="Submit"> </TD></TR>
</FORM>
</HTML>

2)ServletExample.java:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class ServletExample extends HttpServlet{
public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
String name=req.getParameter("name");
String address=req.getParameter("address");
out.println(name);
out.println(address);
}
}

3)In web.xml do the following:

<servlet>
<servlet-name>ServletExample</servlet-name>
<servlet-class>ServletExample</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletExample</servlet-name>
<url-pattern>/ServletExample</url-pattern>
</servlet-mapping>

For more information,visit the following link:

http://www.roseindia.net/servlets/index.shtml

Thanks


Related Tutorials/Questions & Answers:
java http 404 status error - JSP-Servlet
java http 404 status error  I have tried to call a servlet from html page.. but it is showing http 404 status error.. and the description... the following link: http://www.roseindia.net/servlets/index.shtml Thanks
Struts 2 : Http Status Error 404 - Struts
Struts 2 : Http Status Error 404  Hi All, I'm facing the below...: --------------------------------------------------------------------------HTTP Status 404... --------------------------------------------------------------------------- ERROR(404) : "The requested
Advertisements
HTTP Status 404 -
HTTP Status 404 -   HTTP Status 404 - type Status report message description The requested resource () is not available. Apache Tomcat/5.5.31 how to rectify the above error
error of HTTP Status 404 while running servlet on apache tomcat server
error of HTTP Status 404 while running servlet on apache tomcat server ... here, the browser responds "HTTP Status 404 - /java_mail/hello" wht could... and have set classpath properly. on typing "http://localhost:8080" i do get
HTTP Status 404 - Struts
HTTP Status 404   Hello, i am making a program of tiles using Struts2. i face error HTTP Status 404 May 4, 2010 11:31:59 AM... error SEVERE: Dispatcher initialization failed Unable to load configuration
HTTP Status 404 - /web/login/showLogin.action Error in Struts 2 - Struts
HTTP Status 404 - /web/login/showLogin.action Error in Struts 2  Hi... the doLogin action . when I click on the link I get the following error type Status... here)/src/all the java files /WebContent
HTTP Status 404 - JSP-Servlet
,Suddenly i found my server throwing the following Error: HTTP Status 404...HTTP Status 404  Respected Sir/madam, I am R.Ragavendran.. I... are in the same directory.. Also it was very very sudden error i found.. Before
HTTP Status 404 - /Login/userdetail.java
HTTP Status 404 - /Login/userdetail.java  I using netbeans to coonect.. why always error.. help pls.. thx index.jsp <%@page contentType...;head> <meta http-equiv="Content-Type" content="text/html; charset
HTTP Status 404 - /user/AddToCart.do - Struts
HTTP Status 404 user AddToCart   Hi, I download the JSP source code to run the online shopping cart. Whenever I try to add a Item to cart, it shows me the error page with HTTP Status 404 - /user/AddToCart.do What
Still getting the http 404 error - Java Beginners
is userid? Anyway, whatever I do, I still receive the http 404 error...saying...Still getting the http 404 error  Dear experts, I refer to the last solution given to me. A few clarification:- 1. I must stress
error "HTTP Status 500"
error "HTTP Status 500"  How to solve this error "HTTP Status 500
Also HTTP Status 404 - /Login/userdetail.java
Also HTTP Status 404 - /Login/userdetail.java  same can't to run.. error also please help.. index.jsp <%@page pageEncoding="UTF-8"%> <html> <head> <meta http-equiv="Content-Type" content
Error : http status 500?
Error : http status 500?  hello sir, am using netbeans6.7.1 version i implemented one program i.e web application ..when am excuting this one i got one error http status 500...please solve this error ..when did i mistakn
http 404 resource not found error
http 404 resource not found error   Sir, I have downloaded your... in tomcat manager. But when I try to run I am getting http 404 requested resource not found error. Kindly advise. ss
Getting HTTP 404 error in Spring web MVC with Hibernate Integration
Getting HTTP 404 error in Spring web MVC with Hibernate Integration   Hi, i am Getting HTTP 404 error in Spring web MVC with Hibernate Integration...;Please visit the following links: http://www.roseindia.net/struts/hibernate-spring
http status 500 error in tomcat 6 while using eclipse helios
http status 500 error in tomcat 6 while using eclipse helios   package com.lala.servlets; import javax.servlet.*; import javax.servlet.http.... The server encountered an internal error () that prevented it from fulfilling
http status 500 error in tomcat 6 while using eclipse helios
http status 500 error in tomcat 6 while using eclipse helios   package com.lala.servlets; import javax.servlet.*; import javax.servlet.http.... The server encountered an internal error () that prevented it from fulfilling
http status 500 error in tomcat 6 while using eclipse helios
http status 500 error in tomcat 6 while using eclipse helios   package com.lala.servlets; import javax.servlet.*; import javax.servlet.http.... The server encountered an internal error () that prevented it from fulfilling
http status 500 error in tomcat 6 while using eclipse helios
http status 500 error in tomcat 6 while using eclipse helios   package com.lala.servlets; import javax.servlet.*; import javax.servlet.http.... The server encountered an internal error () that prevented it from fulfilling
http status 500 error in tomcat 6 while using eclipse helios
http status 500 error in tomcat 6 while using eclipse helios   package com.lala.servlets; import javax.servlet.*; import javax.servlet.http.... The server encountered an internal error () that prevented it from fulfilling
404 error
404 error  struts application having 404 error while hosting to a online server.it works fine in my local machine but dont work in virtual host.showing 404 error
404 error
404 error  i have 404 error in my addition programe of servlet how should i solve this. i'm using netbean on glassfish server
404 error
404 error  i have 404 error in my addition programe of servlet how should i solve this. i'm using netbean on glassfish server
404 status received in xmlhttp.status - Ajax
404 status received in xmlhttp.status  Hi! I tried out the code I found here using the AJAX login page. However, instead of using PHP for the server... is that I am getting the status 404, instead of 200. thus, I am unable
404 error
404 error   hello anybody help me when i deployed my ear file into jboss->server-> default->deploy folder it doesn't shows any error. but when i run this application by using localhost:8080/webapp ,it shows 404 error
loginform giving 404 error
the submit button the give error is populated. HTTP Status 404 - /login.do type Status report message /login.do description The requested resource (/login.do...loginform giving 404 error  Hi, I am developing a login form code
HTTP Status 500 -
HTTP Status 500 -   I've installed my Java libraries, and I am... attempt to load a JSP file from my Apache Tomcat server I get the error below. TTP Status 500 - type Exception report message description The server
HTTP Status 500 -
HTTP Status 500 -   Hi, I am new to jsp... Installed Tomcat 5.5.... wrote. i can see these errors... HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented
How do I throw a 404 error from within a java servlet?
How do I throw a 404 error from within a java servlet?  How you can write code in Servlet for throwing the httpd error 404? How to add...-code>404</error-code> <location>/WEB-INF/views/notfound.jsp<
defined actions in struts config still getting a HTTP 404 - Struts
I get this error HTTP Status 404 - Invalid path /pages/tiles/AddNewCurrency...defined actions in struts config still getting a HTTP 404  Hi guys, I am getting an Invalid Path requested error. Heres the code snippet from
loacation of errorpage in web.xml for 404 error
loacation of errorpage in web.xml for 404 error   The webpage cannot be found HTTP 404 Most likely causes: ‚?ĘThere might be a typing error... to and look for the information you want. More information This error (HTTP 404
 

 

 

DMCA.com