This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes Submit HTML form Data thru Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Submit HTML form Data thru Servlet" Watch "Submit HTML form Data thru Servlet" New topic

Submit HTML form Data thru Servlet

swati bannore
Ranch Hand

Joined: Oct 18, 2000
Posts: 201
I have a feedback form which receives a input from user.When user "Submits" this data ,it shd be stored in a file.This data storage is done by a Servlet.I ve written a Servlet but getting "Not given a directory to write survey results!"
In my Feedback Form I am passing a value to servlet as follows
<form action="" method=POST>
<input type=hidden name=survey value=Survey01Results>
And I am using getInitParameter.
Somthing somewhere i'm missing.
Can u help me??

Swati Kale
Siva Jagadeesan
Ranch Hand

Joined: Oct 31, 2000
Posts: 160
Dear Swati:
i think u have to use getParameter("survey").

Rgds<p>--Siva Jagadeesan<br /><a href="" target="_blank" rel="nofollow"></a><br />Sun Certified Java2 Programmer<br />Sun Certified Web Component Developer<br />BEA Certified Weblogic Server 7 Enterprise Developer
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
I believe when a directory is not specifically given, it (assuming you are using servletrunner) tries to write it to a Tmp folder in the default directory. So just create a Tmp folder in your default directory. i.e c:\Tmp in my own case.
Good luck.

So much trouble in the world -- Bob Marley
neeta h

Joined: Nov 26, 2000
Posts: 3
hi swati
there is no need to give physical path. u can do it this way
<form method="GET" action="../servlet/servletreq">html form
though directory is servlets use "../servlet/xyz" where xyz is ur servlet class file.
use getParameter() method to acess form fields
hope this will help u.
I agree. Here's the link:
subject: Submit HTML form Data thru Servlet
It's not a secret anymore!