aspose file tools*
The moose likes JSP and the fly likes setAttribute() vs. setParameter() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "setAttribute() vs. setParameter()" Watch "setAttribute() vs. setParameter()" New topic
Author

setAttribute() vs. setParameter()

Michael Rosenthal
Greenhorn

Joined: Nov 17, 2003
Posts: 27
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


Sun Certified Java2 Programmer - 1.4 - SCJP<br />Sun Certified Web Component Developer for J2EE Platform - SCWCD
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Yashnoo lyo
Ranch Hand

Joined: Feb 17, 2003
Posts: 152
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..


When I face C# and Java I choose Java.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setAttribute() vs. setParameter()