aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jsp:param more deatils needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "jsp:param more deatils needed" Watch "jsp:param more deatils needed" New topic
Author

jsp:param more deatils needed

Reshma Shanbhag
Ranch Hand

Joined: Sep 17, 2002
Posts: 203
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,


SCJP 1.4, SCWCD 1.4
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

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".


Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
Reshma Shanbhag
Ranch Hand

Joined: Sep 17, 2002
Posts: 203
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

Joined: Nov 16, 2005
Posts: 502

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

Joined: Sep 17, 2002
Posts: 203
Thanks for your help prabhu.


Regard's
Reshma
Sandeep Chhabra
Ranch Hand

Joined: Aug 28, 2005
Posts: 340
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?


Regards<br />Sandy<br />[SCJP 5.0 - 75%]<br />[SCWCD 1.4 - 85%]<br />------------------<br />Tiger, Tiger burning bright,<br />Like a geek who works all night,<br />What new-fangled bit or byte,<br />Could ease the hacker's weary plight?
Reshma Shanbhag
Ranch Hand

Joined: Sep 17, 2002
Posts: 203
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

Joined: Aug 28, 2005
Posts: 340
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

Joined: Sep 17, 2002
Posts: 203
Sandeep.


Regards,
Reshma
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
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


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Reshma Shanbhag
Ranch Hand

Joined: Sep 17, 2002
Posts: 203
Narendra, thats is very useful info to me.

Thanks,
Reshma
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:param more deatils needed