Re: jstl not working for me

Gene McCullough <[email protected]> Tue, 24 May 2005 14:27:54 -0500
Newsgroups gmane.comp.java.keel.devel
Message-ID <[email protected]>
Thanks Shash.  No joy. With that code, i get following error:
"${! header.map['nested'].empty}" contains invalid expression(s): 
javax.servlet.jsp.el.ELException: Encountered "empty", expected one of 
[<IDENTIFIER>]

i'll dig around some more, was just hoping I'd made a typo or syntax 
error somewhere

Ciao
gene

Sasvata (Shash) Chatterjee wrote:
> Gene,
> 
> Can you try:
> 
>    <c:if test="${! empty header}">
>           <tr>
>       <c:if test="${! header.map['nested'].empty}">
>       not empty
>       </c:if>
>       <c:if test="${header.map['nested'].empty}">
>       empty
>       </c:if>
>        </tr>
>    </c:if>
> 
> If that works, the explanation might be that since we are actually 
> returning an ArrayList instead of a List directly, JSTL isn't working 
> (evidently it only supports List and Map). The code above is supposed to 
> use the "empty" property (or isEmpty() method) of ArrayList.  If the 
> code above works, we should probably change line 69 in 
> ResponseElementDynaBean from:
>            ArrayList newNested = new ArrayList();
> to
>            List newNested = new ArrayList();
> 
> If that doesn't work, I'm stumped as well.  If it does work, I'll still 
> be stumped since ArrayList does implement List (I guess we could look at 
> JSTL code to see what the heck it is doing).
> 
> Shash
> 
> Gene McCullough wrote:
> 
>> Actually, I had, but had caught that one.  As you said, no error 
>> messages, you just get the <c:if... tags showing up in your html.
>>
>> I'm stumped.  The code works for the menu outputs, and my model is 
>> adding the nested outputs with the add method (the only way I know 
>> to), and they show up using the struts taglib.
>>
>> i'll keep hacking
>> thanks Louis
>> gene
>>
>> Louis Moore wrote:
>>
>>> Sorry if this is too obvious, but did you forget to
>>> add the taglib declaration to your jsp?
>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"
>>> prefix="c"%>
>>>
>>> That's bitten me before, cuz it doesn't give you any
>>> helpful error messages or anything.
>>>
>>> -Lou
>>>
>>> --- Gene McCullough <[email protected]> wrote:
>>>
>>>> I have this code in my jsp (ought to look familiar,
>>>> i think i robbed it from app-crud at one point)
>>>>
>>>>         <logic:present name="header">
>>>>            <tr>
>>>>            <logic:iterate id="eachHeader"
>>>> name="header" property="nested">
>>>>               <td>
>>>>               <logic:present name="eachHeader"
>>>> property="attributes.sort">
>>>>                 <keel:command link="true"
>>>> name="eachHeader" property="attributes.sort">
>>>>                 <strong><bean:write
>>>> name="eachHeader"/></strong>
>>>>                 </keel:command>
>>>>               </logic:present>
>>>>
>>>>               <logic:notPresent name="eachHeader" 
>>>> property="attributes.sort">
>>>>                   <strong><bean:write
>>>> name="eachHeader"/></strong>
>>>>               </logic:notPresent>
>>>>               </td>
>>>>            </logic:iterate>
>>>>            </tr>
>>>>         </logic:present>
>>>>
>>>> That produces the desired results.
>>>>
>>>> Adding the following directly beneath in the same
>>>> page produces the empty output.  Any suggestions?
>>>>
>>>>     <c:if test="${! empty header}">
>>>>            <tr>
>>>>        <c:if test="${! empty header.map['nested']}">
>>>>        not empty
>>>>        </c:if>
>>>>        <c:if test="${empty header.map['nested']}">
>>>>        empty
>>>>        </c:if>
>>>>         </tr>
>>>>     </c:if>
>>>> I also tried with header.map.nested, as in the
>>>> menubar.jsp, with the same results.  the struts tags above can find the
>>>> outputs, can you see what I'm doing wrong with the jstl?
>>>>
>>>> TIA
>>>> gene
>>>> http://keelframework.org/documentation.shtml
>>>> Keelgroup mailing list
>>>> [email protected]
>>>>
>>>
>>> http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com
>>>
>>> http://keelframework.org/documentation.shtml
>>> Keelgroup mailing list
>>> [email protected]
>>> http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com
>>>
>> http://keelframework.org/documentation.shtml
>> Keelgroup mailing list
>> [email protected]
>> http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com
> 
> 
> 
> 
> http://keelframework.org/documentation.shtml
> Keelgroup mailing list
> [email protected]
> http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com
> 
http://keelframework.org/documentation.shtml
Keelgroup mailing list
[email protected]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com