Showing posts with label Exception. Show all posts
Showing posts with label Exception. Show all posts

Monday, September 3, 2007

JBoss - JasperException in JSP using generics and 'for each'

JBoss 4.2.0 throws the following exception while using generics in JSP even if java version is 1.5 or greater

Syntax error, parameterized types are only available if source level is 5.0
Syntax error, 'for each' statements are only available if source level is 5.0

The workaround for this issue is to add the following XML configuration to
${jboss.home}/server/default/deploy/jboss-web.deployer/conf/web.xml

Add

<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.5</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.5</param-value>
</init-param>

inside <servlet> tag with <servlet-name>jsp</servlet-name> inside it.
(Note that there are many servlet tags in this web.xml, so be careful)