1 Reply Latest reply on Feb 19, 2010 10:42 AM by ssilvert

    JSF body onload problem

      I want to call body on load javascript method like this: <body onload="enableNextButton(#{purchaseP.index})">

       

      But i get error:

       

      SEVERE: Servlet.service() for servlet Faces Servlet threw exception
      org.apache.jasper.JasperException: /p/p.jsp(12,83) #{...} is not allowed in template text
          at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
          at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
          at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:102)
          at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:746)
          at org.apache.jasper.compiler.Node$UninterpretedTag.accept(Node.java:1246)
      ...

       

      How can i solve this? Thank you

        • 1. Re: JSF body onload problem
          ssilvert

          It's kind of a subtle difference, but JSF EL expressions are handled only inside JSF tags.  I'm over-simplifying a bit, but in general you use #{} in JSF and use ${} for things that are processed by JSP.

           

          The <body> tag is not a taglib tag, but it is processed by JSP so you need to use ${}.  These tags are processed quite differently so you need to make sure that whatever is inside your expression is resolvable at JSP translation time.

           

          Also see ExpressionLanguageFAQ.

           

          Stan