You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by sp...@gmx.eu on 2011/09/12 19:16:11 UTC

EL in Tomcat 7

Hi,

in a jsp I have an expression like this:

${states.get(state)}

On my dev machine everything works fine, on the staging it does not work, I
get:

java.lang.NoSuchMethodException: java.util.HashMap.get(java.lang.Integer)

states is:

Map states = new HashMap();
states.put(1, "foo");
...


Both machines running Java 1.6 with Tomcat 7.

What may be the problem here?

Thank you


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: EL in Tomcat 7

Posted by sp...@gmx.eu.
> In 7.0.21 it works:

OK, thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: EL in Tomcat 7

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/9/12  <sp...@gmx.eu>:
>> What exactly version on Tomcat 7.0.x? There is a new one every month.
>
> .get(..) works on 7.0.5 but not on 7.0.8
>

There was a lot of important fixes since 7.0.8.

In 7.0.21 it works:
[[[
<%@page import="java.util.*" %>
<% Map states = new HashMap();
   states.put(1, "foo");
   pageContext.setAttribute("states", states);
   pageContext.setAttribute("state", 1);
%>
The value: ${states.get(state)}
]]]

results in
[[[
The value: foo
]]]

You should have tested 7.0.21 by yourself.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: EL in Tomcat 7

Posted by sp...@gmx.eu.
>> ${states.get(state)}
>
> Did it work before, and in what exact versions of Tomcat?

Only on dev with 7.0.5

> I would write that as ${states[state]}

This works.

> What exactly version on Tomcat 7.0.x? There is a new one every month.

.get(..) works on 7.0.5 but not on 7.0.8


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: EL in Tomcat 7

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/9/12  <sp...@gmx.eu>:
> Hi,
>
> in a jsp I have an expression like this:
>
> ${states.get(state)}

Did it work before, and in what exact versions of Tomcat?
I would write that as ${states[state]}

>
> On my dev machine everything works fine, on the staging it does not work, I
> get:
>
> java.lang.NoSuchMethodException: java.util.HashMap.get(java.lang.Integer)
>
> states is:
>
> Map states = new HashMap();
> states.put(1, "foo");
> ...
>
>
> Both machines running Java 1.6 with Tomcat 7.

What exactly version on Tomcat 7.0.x? There is a new one every month.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org