• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

what is differnce between request.getAttribute & request.getParameter?

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can anybody please tell me what is dufference between request.getAttribute & request.getParameter?
PLease.
Thank you.
Pras
 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you will always get string from getParameter,where as getAttribute gives you Object that may be any java object.
more than this i can't say.

 
Pras Tiwari
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ,
thank you for reply,
But then if I want to set request parameter into my action class, how to set it?
how to set request parameter into action class ?
Please reply..
Thank you.
pras
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is another difference:

You can both set and get attributes in your action class. With parameters, you can't set them, but only get them.

Parameters can come from one of the following:

1-Strings passed in the query string. exmple:
http://mycompany.com/myapp/myAction.do?foo=xyz&bar=abc

2-Strings passed by submitting a form. example:

<html:form action="/myAction" >
<html:text property="foo" />
<html:text property="bar" />
<html:submit property="submitButton" />
</html:form>

In both cases, request.getParameter("foo") and request.getParameter("bar") will yield results.
[ August 02, 2006: Message edited by: Merrill Higginson ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic