I installed jsdk2.0 in my win98 system.and i set the path as c:/jdk1.3/bin; but when i compile my servlet iam getting an error saying that, cannot read the PostParametersServlet.java. and my servlet is
package servlets; import java.io.*; import java.util.*; import javax.Servlet.*; public class PostParametersServlet extends GenericServlet { public void service(ServletRequest request,ServletResponse response)throws ServletException,IOException { PrintWriter pw=response.getWriter(); Enumeration e=request.getParameterNames(); while(e.hasMoreElements()) { String pname=(String)e.nextElement(); pw.print(pname + " = "); String pvalue=request.getParameter(pname); pw.println(pvalue); } pw.close(); } } and my html file is: <html> <body> <center> <form name="form1" method="post" action="http://localhost:8080/servlet/PostParametersServlet"> <table> <tr> <td><b>employee</td> <td><input type=textbox name="e" size="25" value=" "></td> </tr> <tr> <td><b>phone</td> <td><input type=textbox name="p" size="25" value=" "></td> </tr> </table> <input type=submit value="SUBMIT"> </body> </html> and my package servlets is in c:/jsdk2.0/lib; please can anyone help me what is the actual problem in compilation?iam not able to find out the problem.
rekha adapa
Greenhorn
Joined: Mar 14, 2001
Posts: 27
posted
0
Tell me what is my mistake?
rekha adapa
Greenhorn
Joined: Mar 14, 2001
Posts: 27
posted
0
is there anybody to help me?Iam waiting for someone to reply my question. bye rekha
Saran Vel
Ranch Hand
Joined: Nov 03, 2000
Posts: 111
posted
0
Hi, Make sure u r compiling u'r servlet from the directory jsdk2.0\lib\servlet servlet.jar shuld be included in u'r classpath current directory also shuld be included in classpath, say set CLASSPATH=%CLASSPATH%;.; Make sure u r putting u'r servlet classes in correct directory.. read documentation carefully..
------------------ Saran Sun Certified Java2 Programmer
Saran<BR>Sun Certified Java2 Programmer
paul sun
Greenhorn
Joined: Dec 22, 2000
Posts: 28
posted
0
"package servlets;" ??
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
posted
0
wow! you sound like you are demanding...7:08 am 7:28 am and 7:34 am. I do understand that you want to solve the problem asap. If I could suggest one thing, please be patient when you are starting to learn something new. anyways! pl. le us know what happened, now I am more curious.... And off the record, not many people would suggest the use of JSDK. Try to switch to Tomcat or other servlet containers/app servers when you get a chance. My $0.02. regds. - satya
And BTW Rekha, I just realised this is your first post (well, now I get the whole picture) Welcome to the javaranch discussion forums. Trust me people here are friendly and willing to help. Just because it was a little too early on a working day may be you din't get a fast response today. Hope you stick around and have fun. regds. - satya
[This message has been edited by Madhav Lakkapragada (edited March 14, 2001).]
Ramneek Handa
Ranch Hand
Joined: Nov 10, 2000
Posts: 44
posted
0
Hi Rekha comment like package servlets; from yours servlet because your form action is <form name="form1" method="post" action="http://localhost:8080/servlet/PostParametersServlet"> that means you are not puting your servlet in any dir. called servlet so comment your first line of servlet and it will get complied. try that and let me know. Bobby ;-}
Rahul Rathore
Ranch Hand
Joined: Sep 30, 2000
Posts: 324
posted
0
Methinks:- 1. Place the .java file in c:\jsdk2.0\lib\servlets since your package is servlets. 2. Change to directory c:\jsdk2.0\lib (NOT c:\jsdk2.0\lib\servlets) 3. Ensure that classpath is set properly to include current directory and directory of servlet.jar (read documentation). 4. While in c:\jsdk2.0\lib, enter the following command:- [B]javac servlets\PostParametersServlet.java [B] This should compile successfully I think. Madhav, it feels great to read your posts. Makes it worth visiting the Java Ranch. [This message has been edited by Rahul Rathore (edited March 15, 2001).]
rekha adapa
Greenhorn
Joined: Mar 14, 2001
Posts: 27
posted
0
Rahul, but i only find a single notepad called "jsdk" in c:/jsdk2.0/lib. There is no "servlet.zar" in lib.
rekha adapa
Greenhorn
Joined: Mar 14, 2001
Posts: 27
posted
0
Hi madhav, i didn't want to demand anybody actually.i wanted to get the answer asap. Anyway iam sorry for making u feel so. bye rekha.
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
posted
0
i didn't want to demand anybody actually. noooooo......i was just teasing you..... i wanted to get the answer asap. i think i already said that! Anyway iam sorry for making u feel so. well, we want the javaranch to be a friendly place, no sorry no thanks, well maybe Thanks! So does it work now? But the more serious thing you need to consider is that the use of JSDK will disappoint a lot of people in this forum - one for sure is Bill Brogden, the famous author. I am surprised he isn't in this discussion yet! One of his famous stmts is "No, not JSDK again". regds. - satya
rekha adapa
Greenhorn
Joined: Mar 14, 2001
Posts: 27
posted
0
O.k. then iam trying to download the tomcat webserver.In that iam selecting binary version,release build.butb again in the binary version there r so many options. Which one should i select?