Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Joshua Cloch
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

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

Thanks.
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As because paramValues MAP implementation, you can use traditional method size().

For Example,

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot,guys!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic