Hi Kenny.  Responses below --

On Thu, 24 Oct 2002, MacLeod, Kenny wrote:

> I've just started delving into JSTL, and I've run into some
> inconsistent behaviour between some of the tags.  This behaviour
> concerns how the EL evaluates bean expressions.
> 
> For example, say I have a bean "user", with a method "getUserName()".  
> The EL expression "${user.userName}" works fine in all cases.  
> However, if I use the expression "${user.UserName}" (note the change
> of case), then it works in some cases, but not others.

Per the JavaBeans specification, ${user.userName} should work, and
${user.UserName} should not work.

> Specifically, it works for the "value" attributes of <c:set> and
> <c:out>, but it doesn't work for <fmt:formatDate> or <c:param>.  The
> latter cases throw the exception 'Unable to find a value for
> "UserName" in object'.
> 
> I've tried 1.0.1 and 1.0.2, but both behave the same.  I can't find
> any previous mention of this problem, either.  A read through the spec
> doesn't yield any clues, but I could be missing something.

Are you certain that you've factored out all other possibilities.  In the
minimal case, it works correctly for me.  That is, for me, given the
following start to a page:

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

  <%!
    public static class Foo {
      public String getUserName() { return "George"; }
    }
  %>

  <% pageContext.setAttribute("user", new Foo()); %>

the following prints "George":

  <c:out value="${user.userName}" />

and the following yields an error:

   <c:out value="${user.userName}" />

I'm using 1.0.2, but nothing in 1.0.2 should differ from 1.0.1 or 1.0 in
this regard.

Please post more information if you can reproduce the bug.  Thanks,

-- 
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org>

Reply via email to