File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

setAttribute() vs. setParameter()

Michael Rosenthal

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.

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

Joined: Jan 10, 2002
Posts: 62761

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,"post","mytest.jsp?param="+document.textbox.value,true);
I want to know which is good too..

When I face C# and Java I choose Java.
I agree. Here's the link:
subject: setAttribute() vs. setParameter()