| Author |
difference between servlets parameters and arguments
|
Micale Raj
Ranch Hand
Joined: Jul 01, 2009
Posts: 30
|
|
|
what are differences between servlets parameters and arguments and how to access parameters and attributes ?
|
 |
Mark Wa
Ranch Hand
Joined: May 29, 2009
Posts: 122
|
|
As I understand an attribute can be a java object. A parameter is something passed across in the HTTP POST or GET
or
take a look at http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpServletRequest.html
|
 |
Mark Wa
Ranch Hand
Joined: May 29, 2009
Posts: 122
|
|
|
it would also be useful reading up about HTTP POST and HTTP GET if you dont know.
|
 |
Nandhakumar Soundarrajan
Greenhorn
Joined: Apr 24, 2009
Posts: 23
|
|
Hello Mayura,
Hope you are trying to find the difference b/w request parameter and attributes.
Request Paramter:
Request Parameter are name value pairs and both the name and the value are strings.
Consider that you have a form with a text box say , so when this form is submitted to a servlet or another JSP. You can get the value entered by the user in the textbox (firstName), through which returns the value entered in the textbox.
Request Attributes:
Request Attributes are objects, and can be placed in the request, session, or context. As they are objects and not just String, they are much more flexible to use. You can set attributes programatically and retrieve them later.
Consider in a JSP page you have a connection object and you are setting it to the request attribute through the code
you can retrieve the Connection object in servlet by using the following code.
Note: You need to cast the object which you retrieve from request attribute.
Hope this helps.
|
Thanking the green horns sincerely,
Nandha
|
 |
 |
|
|
subject: difference between servlets parameters and arguments
|
|
|