Hiho!
It is possible, but only with a little trick.
Using a parameter in the EL is a new EL-2.2 feature which is _not_ part of
JSP-2.1 delivered with tomcat6 and jetty6 but defined in JSR-245 MR-2 (JSP-2.2)
[1].
You can enable EL-2.2 by using a few tricks even in tomcat-6 and jetty6.
Here is how goes:
A.) You have to use el-api.jar and el-impl.jar from the glassfish reference
implementation. In your pom.xml:
<!-- EL 2 -->
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<profiles>
<profile>
<id>jetty</id>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>${jetty-version}</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<scope>runtime</scope>
<version>2.2</version>
</dependency>
</dependencies>
</profile>
</profiles
This will allow you to use EL-2.2 by running
$> mvn clean install -Pjetty jetty:run
B.) preparing tomcat
1. go to the tomcat home directory
2. remove tomcats el-api.jar from the classpath:
$> mv ./lib/el-api.jar ./lib/el-api.jar.nixda
3. copy the EL-2.2 jars into ./lib (el-api-2.2.jar, el-impl-2.2.jar)
4. make sure that the applications don't contain those 2 el jars!
voila, have fun!
LieGrue,
strub
[1] http://jcp.org/aboutJava/communityprocess/mrel/jsr245/index.html
--- Michael Kurz <[email protected]> schrieb am Mi, 10.2.2010:
> Von: Michael Kurz <[email protected]>
> Betreff: Re: el expression
> An: [email protected]
> Datum: Mittwoch, 10. Februar 2010, 9:33
> Hi,
>
> it is true that it is not possible to use method parameters
> or to call
> methods of an object that are no getters or setters (at
> least before
> Java EE 6).
>
> But there are ways to bypass this limitation:
>
> * If you only want to call a method in an EL expression you
> could define
> an EL function (possible with JSP and Facelets).
>
> * If you want to pass a parameter to an action method you
> could use an
> alternative EL implementation like JBoss EL (see [1]). For
> this you have
> to include the JBoss EL libraries and replace the
> expression factory of
> MyFaces like this in your web.xml:
>
> <!-- Replace ExpressionFactory for
> Apache MyFaces -->
> <context-param>
>
> <param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
>
> <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
> </context-param>
>
> regards
> Michael
>
> [1]:
> http://docs.jboss.org/seam/2.0.1.GA/reference/en/html/elenhancements.html
>
> Am 10.02.2010 09:20, schrieb Martin Monshausen:
> > Hi,
> > calling methods with parameters is not possible in JSF
> as far as I know. Try to set Parameter in Bean before
> calling the method and then refer to it in your
> parameter-less method.
> > Yours,
> >
> > Martin
> > ________________________________
> >
> > Von: Krishna K. Pandit [mailto:[email protected]]
> > Gesendet: Mi 10.02.2010 06:14
> > An: MyFaces Discussion
> > Betreff: el expression
> >
> >
> >
> > Hi all
> >
> > Can any one can help me how to pass a parameter to a
> method while
> > calling it in EL expression.
> > Im trying this
> >
> > "#{myBean.method('JAVA')}
> >
> > But I m getting errors while rendering.
> >
> > Thanks
> > Krishna Pandit
> > This email and any files transmitted with it are
> confidential and intended
> > solely for the use of the individual or entity to whom
> they are addressed.
> > If you have received this email in error please notify
> the sender by email
> > reply and delete it from your system.
> > The integrity and security of this email cannot be
> guaranteed on the Internet.
> >
> >
> >
> >
>
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen
Massenmails.
http://mail.yahoo.com