This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes to pass variable to servlet from html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "to pass variable to servlet from html" Watch "to pass variable to servlet from html" New topic
Author

to pass variable to servlet from html

anamika das
Greenhorn

Joined: Aug 17, 2005
Posts: 1
I have a table with a checkbox in each row..and a submit button at the end.
On click of the submit button the named or id's of the checkboxes clicked should reach the servlet called from action tag of the html or jsp form
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

OK.

Is there a question?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you're going to program for the web, you'll need to get a basic understanding of HTTP and how HTTP Forms work. This is the same whether you're using Servlets, JSP, PHP, ASP, Perl, DOT_NET, etc...

This chapter
http://csajsp-chapters.corewebprogramming.com/CSAJSP-Chapter16.pdf covers them.

If you're going to write servlets, I highly recommend reading the whole book - as well as the 2nd edition "More Servlets and Java Server Pages".


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
samdeep aarzoo
Ranch Hand

Joined: Jun 09, 2005
Posts: 160
send parameter from html to jsp or servlet

first go there try to do that excercise
hope this helps
vivek parepalli
Greenhorn

Joined: Jul 16, 2004
Posts: 9
It is a trivial question. You can use the following methods to retrieve info from your HTML file.

<request object>.getParameter(<Parameter name> ;
Amitav Anand
Ranch Hand

Joined: Sep 22, 2003
Posts: 46
Hi Anamika,

I guess u r trying to develop shopping cart sort of application.
Anyways the problem is quite simple..
Just use the getParameter() method of the HttpServletRequest object and access the parameter names..
Then store the corresponding rows into the database.
If u could send the source code of the program...I will try to solve your problem..

bye
 
wood burning stoves
 
subject: to pass variable to servlet from html