permaculture playing cards
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "to pass variable to servlet from html" Watch "to pass variable to servlet from html" New topic

to pass variable to servlet from html

anamika das

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

Joined: Mar 06, 2001
Posts: 13459


Is there a question?
Ben Souther

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 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

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..

I agree. Here's the link:
subject: to pass variable to servlet from html
It's not a secret anymore!