Passing data from Applet to servlet

I have a JApplet which has around 10 JTextFields, JCheckBox, JRadioButtons,  JList, JComboBox, JTextAreas, JButtons etc. and I want to pass all the information entered on this JApplet to servlet. The servlet has to accept this data, update my database and  reply to applet with an acknowledgement which is displayed in a JTextArea on the applet.

I am able to get data from servlet to applet and display the data on applet.
But I am unable to pass the data from JApplet to servlet.

Please use example to describe your solution. What should I code in my Japplet and servlet so that servlet recieves data.

Thanks a lot for your help.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

// connect to the servlet
String location = "";
URL testServlet = new URL( servletLocation );
URLConnection servletConnection = testServlet.openConnection();

// inform the connection that we will send output and accept //input

// Don't use a cached version of URL connection.
servletConnection.setUseCaches (false);
servletConnection.setDefaultUseCaches (false);

// Specify the content type that we will send binary data
             ("Content-Type", "<insert favorite mime type>");

// get input and output streams on servlet
PrintWriter out = new PrintWriter(servletConnection.getOutputStream());
inputStreamFromServlet = servletConnection.getInputStream();

// send your data to the servlet

what u need to do is get the values from ur textfileds,comboboxex,etc..have an appropriate paramname for it which can be retrived from the servlet using getParameter() & just pass it as a string in the out.println(..);

this is the POST method of sending data.

chk out,
for more info.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vilas32Author Commented:
Thanks a lot sgom.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.