File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form Data from Applet-Servlet

 
Sean Casey
Ranch Hand
Posts: 625
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may be a simple question.
I have a checkboxgroup of four choices and a submit button in my applet. I'm not sure how to encode the information and send it to the servlet. Could someone give a basic example of how it would be encoded int the applet? Thanks alot. I understand how to handle it in the servlet, but I'm going wrong somewhere on the front end and I suspect that it is in the encoding value part.
Thanks,
Sean
 
Julia Reynolds
Ranch Hand
Posts: 123
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's an example that does this on http://www.coreservlets.com/ in the source code archive.
Julia
 
Sean Casey
Ranch Hand
Posts: 625
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah, there's an example, but the example doesn't use checkboxes, and I've been having a hardtime trying to execute it with checkboxes.
 
nan sh
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, I found examples are very hard to follow.
 
Julia Reynolds
Ranch Hand
Posts: 123
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if you put four strings in the request and set their values to "True" or "False" based on the check box? Then you could post to the servlet and read out the values and set your database flags accordingly.
Julia
 
Sean Casey
Ranch Hand
Posts: 625
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not using a database. Maybe I should give you more information. I have a poll on my webpage right now. The front end is in html and consists of 5 radio buttons and a submit button. This gets submitted to my servlet through the html. The servlet then updates the results in a file called survey.txt and then returns the results in an html page. Instead of returning the results into an html page, I am trying to return them to my applet. For the applet I used a checkboxgroup consisting of five checkboxes, and only one can be checked. I am having trouble encoding this form data and submitting it to the servlet and then getting the results back to the applet. I thought this would be pretty easy to do with http tunneling, but I'm not sure how to do it with form data. Now that I think about it, using a database would probably be much easier, but I would still like to know how to http tunnel form data. Thanks for your responses though. I wonder if I should get another Servlet book. I'm using the core book.
- Sean
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic