This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting values from id attribute in a servlet

 
sovan chatt
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a html form I have wrritten this,<input type="text" id="demo">,Now if I use the method request.getAttribute("id") in the servlet I get a null value.Why is that?
How can I use "id" attribute declared in a html form ,in a servlet.Or is it the case that only getparameter will work with name attribute
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
id values are not used for form submissions, that's what the name attribute is for.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and you have to use request.getParameter("name"), not request.getAttribute("id") .
 
sovan chatt
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have used the following in <input name="demo1" id="demo1" type="text">,now request.getParameter("demo1") fetches null!!
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this input field inside the form that you're submitting?
 
sovan chatt
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,I used the input field in side the form...Here is the entire form..I used id attributes inside test and Dept. Date field.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic