aspose file tools*
The moose likes Servlets and the fly likes servlet not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet not found" Watch "servlet not found" New topic
Author

servlet not found

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,I have an HTML page;the chosen values from this page has to be retrieved by a servlet;this code was working fine a few months ago..but now when I say servletrunner -d part6\RAF,where part6 is the folder& RAF is the servlet in this folder..on c:
I get an error message saying servlet not found ..
the HTML form's code is below:<html>
<head>
<title>enquiry.html</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body text="#339966" link="#3333FF" vlink="#FF6666" alink="#CC9933">
<p><font size="+3"><u>SURVEY</u></font> </p>
<form method="post" action="http://localhost:8080/servlet/RAF">
<p><legend>Enter your details correctly</legend><b><br>
<font face="Arial, Helvetica, sans-serif" size="+1">Q1.I would like to know
if anybody in your family is using any of these products?</font></b>
<select name="q1" >
<option value="3">SHAMPOO</option>
<option value="2">TOOTH PASTE</option>
<option value="3">TOILET SOAPS</option>
<option value="4">SKIN CREMA/LOTIONS</option>
</select>
</p>

<font face="Arial, Helvetica, sans-serif" size="+1">Q2.I would like to know
if anybody in your family is using any of these products?</font></b>
<select name="q2" >
<option value="27">SKIN CREMA/LOTIONS</option>
<option value="2">TOOTH PASTE</option>
<option value="3">TOILET SOAPS</option>
<option value="4">SHAMPOO</option>
</select>
</p>
<font face="Arial, Helvetica, sans-serif" size="+1">Q3.I would like to know
if anybody in your family is using any of these products?</font></b>
<select name="q3" >
<option value="999">SKIN CREMA/LOTIONS</option>
<option value="3">TOILET SOAPS</option>
<option value="4">SHAMPOO</option>
</select>
</p>
<p><b><font face="Arial, Helvetica, sans-serif" size="+1">Submit:
<input type="submit" value="Submit">
Reset:
<input type="reset" value="Reset">
</font></b>

</form>
</body>
</html>
& the servlet code is:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
import java.util.*;
import java.util.StringTokenizer;
public class RAF extends HttpServlet{
int count,i,k,j,l,a;
String Q,q,str,string,Str,S;
StringBuffer sb = new StringBuffer();
StringBuffer smb = new StringBuffer();
PrintWriter pw,out;
StringTokenizer qstk;
public void init(ServletConfig config) throws ServletException{
super.init(config);
}
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException
{
response.setContentType ("text/html");
PrintWriter out = response.getWriter();
out.println ("<html>");

out.println("<body>");

PrintWriter pw = new PrintWriter (new FileWriter ("c:/part6/ Textfile.txt " ,true) , true );
Enumeration enum = request.getParameterNames();

out.println("thank you for your response");
while(enum.hasMoreElements())
{
Q = (request.getParameter((String) enum . nextElement()));

q += (";"+Q);

}
sb = new StringBuffer(q);
sb.delete(0,5);
q = sb.toString();

StringTokenizer qstk = new StringTokenizer(q,";");
while(qstk.hasMoreTokens())
{
str = qstk.nextToken();
count++;
}



smb.setLength(100);
for(int i =0;i<100;i++)
{
smb.insert(i,0);
}

BufferedReader bf = new BufferedReader( new FileReader("c:/part6/pos.txt "));
while((Str=bf.readLine()) != null)
{
StringTokenizer st = new StringTokenizer(Str,";");

while(st.hasMoreTokens())
{

String Q = st.nextToken();
out.println("Q = "+Q);
String R = st.nextToken();
out.println("R = "+R);
l = Integer.parseInt(R);
String P = st.nextToken();
j = Integer.parseInt(P);
a = (j+(l-1));
out.println("P = "+P);
k = 0;
qstk = new StringTokenizer(q,";");


while(k<count)
{
qstk.hasMoreTokens();
str = qstk.nextToken();
k++;
}

count--;

smb.replace(j,(j+l),str);
//out.println("the smb string is = "+smb);

}

}
pw.println(smb);
pw.close();
out.println("</body> </html>");
out.close();

} // dopost()

} //end.

Can someone help?
Is the command to invoke the servlet correct?
vikas sahni
Greenhorn

Joined: Jan 01, 2001
Posts: 7
your command is ok but you should be sure that your servlet RAF.class is in the servlets dir of your web server
vikas
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: servlet not found