This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes How to count the elements in this implicit object: paramValues? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to count the elements in this implicit object: paramValues?" Watch "How to count the elements in this implicit object: paramValues?" New topic
Author

How to count the elements in this implicit object: paramValues?

Joshua Cloch
Ranch Hand

Joined: Apr 27, 2006
Posts: 95
Hi guys,

Here is the problem, is there any good idea to count the elements in paramValues?

Thanks.


truehh@hotmail.com
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

As because paramValues MAP implementation, you can use traditional method size().

For Example,



Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Originally posted by Prabhu Venkatachalam:
As because paramValues MAP implementation, you can use traditional method size().


No, you can't.

The EL cannot call methods on scoped variables; it is intentionally limited to bean properties.

If you are using JSP 2.0 and JSTL 1.1, the fn:length() function can be used to determine the length of any collection or string.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

missed a line while reading,

Scope objects are NOT the matching objects.

But, Just curious, how this is implemented by the container?
Joshua Cloch
Ranch Hand

Joined: Apr 27, 2006
Posts: 95
Thanks a lot,guys!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Originally posted by Prabhu Venkatachalam:
Scope objects are NOT the matching objects.


I do not know what you mean by this.

But, Just curious, how this is implemented by the container?



How is what implemented?
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

I do not know what you mean by this.


Scope variable in EL like requestScope is not an actual request object. It is MAP of request parameters


How is what implemented?


I read that Scope Objects are MAP implementations. So, I thought it is some kind of data structure like HashMap. Is it so?

These Scope Objects are created by container right? I'm asking how it is implemented by Container?

PS: My mother tongue is not English. you might find difficult in understanding my English. If you are not understanding anything in my question, Please let me know. I try to explain you as much as possible.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Originally posted by Prabhu Venkatachalam:

I read that Scope Objects are MAP implementations. So, I thought it is some kind of data structure like HashMap. Is it so?


While these construsts are required to look and act like Maps from the point of view of the EL, I do not believe that the Spec requires them to implement java.util.Map.

These Scope Objects are created by container right? I'm asking how it is implemented by Container?


Each container is free to implement these constructs as they see fit, as long as they act as required by the JSP Specification.

PS: My mother tongue is not English. you might find difficult in understanding my English.


Your English is fine. I was just not sure what you were specifically referring to.
[ December 11, 2006: Message edited by: Bear Bibeault ]
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

I will read the JSP Specification one more time and come back to you, If I have anything to ask.

Thanks Bear.
[ December 11, 2006: Message edited by: Prabhu Venkatachalam ]
 
 
subject: How to count the elements in this implicit object: paramValues?