7 Replies Latest reply on Jul 5, 2006 9:21 PM by smokingapipe

    Any idea why ELs, like ${user.email}, wouldn't work in JBoss

    smokingapipe

      I have got my application working within JBoss so that it shows a signup form and a login form with JSF, and can now store the new users using EJB, and I now have an authorization filter to protect access to the /protected/* pages. That's all good.

      But within those pages, I created a index.jsp file and I used a line like this:

      Welcome, ${user.firstName}!

      where "user" is stored in the session scope. Instead of evaluating the EL, it literally outputs "Welcome, ${user.firstName}!".

      Any idea what could be going wrong here?

      Thanks

        • 1. Re: Any idea why ELs, like ${user.email}, wouldn't work in J
          peterj

          Shouldn't you first reference the standard tag libraries in your jsp page, such as:

          <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>


          and then use the core 'out' function, such as:

          Welcome, <c:out value="${user.firstName}" />!


          And you will need jstl.jar and standard.jar in WEB-INF/lib.

          • 2. Re: Any idea why ELs, like ${user.email}, wouldn't work in J
            smokingapipe

            Not really. EL is part of JSP 2.0 and has nothing to do with JSTL. Also, displaying things immediately using EL without needing a c:out tag is quite handy. So, any ideas on this? Is EL somehow turned off by JBoss?

            • 3. Re: Any idea why ELs, like ${user.email}, wouldn't work in J
              smokingapipe

              I put in this page directive in my JSP:

              <%@ page isELEnabled="true"%>

              and when I accessed the page I got:

              org.apache.jasper.JasperException: /index.jsp(1,1) Page directive has invalid attribute: isELEnabled

              which indicates to me that JBoss is somehow not providing me with JSP 2.0. Is this correct? I know that JBoss is using Tomcat 5.5.17 which ships with JSP 2.0 but it looks like it isn't there. Any sugestions would be welcome.

              • 4. Re: Any idea why ELs, like ${user.email}, wouldn't work in J
                smokingapipe

                Well I think I found the problem. The class javax.el doesn't appear in any of the jars that ship with JBoss 4.0.4. So it looks like JBoss is in fact shipping with an older JSP setup.

                So I need to somehow install the new JSP jars and have JBoss use those instead. Any suggestions on this?

                • 5. Re: Any idea why ELs, like ${user.email}, wouldn't work in J
                  smokingapipe

                  Never mind about that last post, that isn't right. javax.el.* is of course part of J2EE. JBoss should ship with an implementation of that package. That's where the problem is. Tomcat does have an implementation, but JBoss does not appear to, which I don't understand.

                  • 6. Re: Any idea why ELs, like ${user.email}, wouldn't work in J
                    peterj

                    Are you sure that it is in Tomcat? I just checked 5.5.17 and none of the jars contain the javax.el.* package. (Just wondering if you enhanced Tomcat or installed as part of some other package, and that is how you got javax.el.*. I know that kind of a situation has happened to me before.)

                    • 7. Re: Any idea why ELs, like ${user.email}, wouldn't work in J
                      smokingapipe

                      The problem is solved. As usual, it is something absolutely trivial, which does not show up on any debugging tool. The web.xml doctype was for 2.2, not 2.4. What a difference 0.2 makes. Because the doctype was for an older app, it was giving me JSP 1.2 or whatever, when I need JSP 2.0.

                      This is the curse of Java: most of the hard part of getting an app to run is you spend days or weeks chasing down all these trivial little things, and there's no tool that helps with any of this. Once you have the app running, everything is great. There are amazing debugging tools, etc, but until then, these mystery problems can be a nightmare.

                      I guess that's where experience comes in. It has taken me about 10 days to get a basic EJB 3 + JSF app up and working to where I could sign up and log in. Next time it will take me 10 minutes to do the same.