Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to trace selected CheckedBoxes in different forms using a Single Servlet

 
Faraz Masood
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i had a servlet called createReceipt which will take the selected inputs from three different HTML forms and generate the receipt .
i need to know about ne such pattern which will help me in taking the inputs from the forms
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand you correctly, you want to get the values of the check boxes that are checked. You can just use getParameter. if a checkbox is not checked, it will not be returned at all. i.e.null will be returned.
 
Faraz Masood
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
let me more specific
while trying to make a Shopping cart application i came across this problem
that there are three different (html)forms for three different departments,
a user can move back and forth at will , selecting the items (NOT
DESELECTING) that were there in the form of checkboxes.
and hits checkout button whenever he wants to logout(checkout button can be
hit from any form ) , then we have to display a page containg information
about the purchased goods.
my quesion is how can we trace the selected options of different chechboxes
in three different forms ???
 
Saravanan Viswanathan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
U can have one name(test1) for all the checkboxes in one HTML Form.then u can get the values thru request.getParameterValues("test1") which will give the values of all the Selected checkboxes.
Ex:-
1.html
<input type="checkbox" name="test1" value="100" />
<input type="checkbox" name="test1" value="200" />
Hope this helps.
Saravanan Viswanathan.
 
mustang india
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Faraz,
U cannot directly navigate form one html to other, u have to go thru a servlet. I mean , when u select items in one html, if u go directky to another servlet, the data is lost as http is stateless protocol. What u have to do is, from 1st html, go to a servlet, store the data in a session and let the servlet redirect you to the next html. I hope u got the point.
why dont u consider using JSP ?
Regards,
Mustang.
 
Faraz Masood
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
finally i got the job done
but no JSPs because we had to make that without using JSP
Thanks for the help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic