views:

702

answers:

2

Guys, for some reason EL is not telling actions from properties. I have this page test.xhtml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html   xmlns="http://www.w3.org/1999/xhtml"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:f="http://java.sun.com/jsf/core"&gt;

<body>

<form action="#{TestBean.test}">
    <p>#{TestBean.status}</p>
    <input type="submit" value="Test Again"/>
</form>

</body>

</html>

TestBean.status is a string property (there is a getStatus method) and TestBean.test is a method which return "sucess".

Every time I call the page I get this exception:

ERROR [STDERR] 05/08/2009 17:41:07 com.sun.facelets.FaceletViewHandler handleRenderException
SEVERE: Error Rendering View[/etc/test/test.xhtml]
javax.el.ELException: /etc/test/test.xhtml: Bean: test.TestBean, property: test
    at com.sun.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:53)
    at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
    at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:232)
    at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
    at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
    at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
    at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Unknown Source)

Maybe it's a long shot, I can describe better my environment. But at first glance, any tips?

tks

A: 

As far as I know, EL does not have a syntax to invoke an arbitrary method. The syntax you're using, when applied to anything other than a Map, List, or array, will look for a property getter corresponding to the name; the dot is syntactic sugar for TestBean["test"].

While it is possible to define custom functions for EL as part of a JSP tag library, they must be implemented by static methods. See this tutorial for more information on how to do so.

This feature is currently in the JSR pipeline however.

Jeffrey Hantin
A: 

I think the problem was forgetting the jsfc attribute.

It should be:

<form **jsfc="h:form"** action="#{TestCaseBean.test}">

tks.

mamendex