1

i use netbean 6.9.1 with apache tomcat 6.in my jsf page, i want call method with parameter, for current, i use tomcat 6 with EL default.

i downloaded EL 2.2 from http://download.java.net/maven/glassfish/javax/el/el-api/2.2.0-SNAPSHOT/el-api-2.2.0-SNAPSHOT.jar

http://download.java.net/maven/glassfish/org/glassfish/web/el-impl/2.2.0-SNAPSHOT/el-impl-2.2.0-SNAPSHOT.jar

i renamed these files to el-api-2.2.0.jar and el-impl-2.2.0.jar, then i copy to tomcat lib (C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.26\lib)

In the web.xml, i added this

  <context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
  </context-param>

KategoriManager.java (for testing)

public String editSetup(Integer id) {
    return "kategori_edit";
}

and Edit.jsp

---cut---
<h:commandLink value="Edit" action="#{kategoriManager.editSetup(1)}"/>
---cut---

but in IDE netbean, i still got tooltip error like "the function must be used with prefix"

i run this web, but i got error

HTTP Status 500 -

type Status report

message

description The server encountered an internal error () that prevented it from fulfilling this request.
Apache Tomcat/6.0.26

how to enable EL 2.2 on Tomcat 6 ? please help..

thanks

Igi Shellshock
  • 81
  • 1
  • 3
  • 10

1 Answers1

0

The JARs should be placed in webapp's /WEB-INF/lib, not in server's /lib. You should also make absolutely sure that you don't have another copy of EL API JAR in /WEB-INF/lib. Most starters drop for some unobvious reason for example javaee.jar in /WEB-INF/lib to "fix" compilation errors.

An alternative is to use JBoss EL. See also Invoke direct methods or methods with arguments / variables / parameters in EL for instructions.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • but i got tutorial from [link]http://wiki.apache.org/myfaces/HowToEnableEl22 that jar file copied to server's lib.anyway, where the `code`/WEB-INF/lib ? in netbean, i go to this folder, but just can find two files `code` faces-config.xml and web.xml.im sorry, i'm newbie in java – Igi Shellshock Apr 18 '12 at 17:52
  • i removed el-api and change to jboss-el, i downloaded from http://www.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.jboss.el&version=2.0.0.GA&searchType=bundlesByName&searchQuery=expression but i got same error – Igi Shellshock Apr 18 '12 at 18:23
  • I have no idea how Netbeans works, I have never really used it, but to the point you need to make sure that the JAR ends up in `/WEB-INF/lib` folder of the deployed webapp. This folder is part of standard servlet API and any self-respected IDE like Eclipse and IntelliJ just show it in the project structure. Perhaps Netbeans is hiding or abstracting it away. Consult the Netbeans manual for details. – BalusC Apr 18 '12 at 18:26
  • thx for reply, now i use jboss-el, but i got exceptions org.apache.jasper.JasperException: /kategori/List.jsp(45,24) The function editSetup must be used with a prefix when a default namespace is not specified.thank you – Igi Shellshock Apr 18 '12 at 18:34
  • That just means that the environment is still not EL 2.2 enabled. In other words, the JAR file(s) are not at the right place (or still in server's `/lib`). – BalusC Apr 18 '12 at 18:38