Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

The function get must be used with a prefix when a default namespace is not specified  RSS feed

 
hitendra chopra
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting error while getting values from arraylist using jsp2.0
<c:if test="${calendar.get(1) == 12 && calendar.get(2)+21 > calendar.get(5)}">

The function get must be used with a prefix when a default namespace is not specified

How can i solve this,please help
Thanks in advance
hitu

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66188
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot call general methods in the EL. You'll need to find another way to express this.
 
Stefan Evans
Bartender
Posts: 1836
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if this was valid EL code (which it is not), the calendar.get() calls are really confusing when you use numbers with them instead of constants.
I would much prefer the constants as they are easier to read.

I am going to treat this like a java scriptlet expression for the purpose of rewriting.
Calendar.YEAR = 1
Calendar.MONTH = 2
Calendar.DAY_OF_MONTH = 5

Given that, your code would translate as


When you write it like that, it doesn't make much sense. I think maybe you used the wrong fields in the comparision.
Comparing year to 12 - you probably meant month?
And I can't figure out at all what the number 21 has to do with anything...

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!