Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setAttribute() vs. setParameter()

 
Michael Rosenthal
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please explain to me when in both a jsp and a servlet I should one of the above instead of the other? I am not sure when I should be using setParameter vs. setAttribute.
Thanks,
Michael
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64701
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setParameter? If you are talking about the HttpServletRequest, there is no such method.
Parameters are the result of either a form submission, or of parameters specified directly on the URL.
Attributes are objects placed in a map that the request (or session, or servlet context, or page context) maintains.
 
Yashnoo lyo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mybe your meaning is XMLHttp, xml.open("post","mytest.jsp?param="+document.textbox.value,true);
VS
request.setAttribute("param",.....)
I want to know which is good too..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic