• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp:param more deatils needed

 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The HFSJ book, chapter 8 pg no 415, state's


if the param name is used in jsp aram already has a value in the request parameter, the new value will overwrite the previous one. Otherwise, a new request parameter is added to the request.



It will be helpful to me if one of you could clear what does this actually mean.


Thanks in Advance,
 
Ranch Hand
Posts: 502
jQuery Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If a request object has a parameter named "username" with some value, this below code will replace its value to "Prabhu".

<jsp:forward page="login.jsp">
<jsp aram name="username" value="Prabhu"/>
</jsp:forward>

If not found, it will create new parameter "username" and add its value as "Prabhu".
 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
prabhu,

what do you mean, request has a parameter 'username' with some value ..

i guess you mean to say if there was a parameter in query string with the name 'userName' having some value, the code u provided would replace its value of userName to 'Prabhu' for login.jsp forward standard only and if not exsist would create one and set the mentioned value?

Thanks for your help ..
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
jQuery Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

what do you mean, request has a parameter 'username' with some value ..



you are correct.

" request parameters = form(HTML FORM) parameters "
 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help prabhu.


Regard's
Reshma
 
Ranch Hand
Posts: 340
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Reshma Pai:
prabhu,
i guess you mean to say if there was a parameter in query string with the name 'userName' having some value...




Just to add here that its not compulsory to have request parameters in query string only.

What if post method is used to submit the parameters to a resource?
 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sandeep,

To my knowledge using POST method should not make difference regarding the parameters submitted to the server program.

Using GET method, the query string is visible in the browser bar while with POST its not.


Reshma
 
Sandeep Chhabra
Ranch Hand
Posts: 340
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The parameters that are sent to the server through post method, are they called query String?

I am talking about something off topic.
I just wanted to say that if there was a parameter, not just in query string but also in payload, then even its value would get replaced by new value.

I Was just elaborating the sentance:


i guess you mean to say if there was a parameter in query string with the name 'userName' having some value...



Thats It!!
 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sandeep.


Regards,
Reshma
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The parameter values either in payload or query string are not replaced by the values specified in the <jsp aram>. The values are still avilable there. Only the values specified in <jsp aram> take preferenece to the old parameter values. When you use getParameter on the request object, it return the first value which is specified by the <jsp aram>. The request parameters can have multiple values. You can access all values using getPrarameterValues() method, which return arrary of string of values.

The parameter values specified in the <jsp aram> are applicable for the given forward or include tag.

Hope this help

Thanks
 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Narendra, thats is very useful info to me.

Thanks,
Reshma
 
reply
    Bookmark Topic Watch Topic
  • New Topic