You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Werner Punz <we...@gmx.at> on 2005/04/20 16:12:52 UTC

JSTL-Faces bridge broken?

Hi, I am currently in the migration process
from 1.0.9 myfaces RC1 to the final one.
I have following construct in my navigation:

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>
<%@ taglib prefix="c" uri="/WEB-INF/c-rt.tld" %>
<x:panelNavigation id="nav"
               styleClass="navigation"

               itemClass="navitem"
               activeItemClass="navitem_active"
               openItemClass="navitem_open"   >
     <c:if test="${userData.loggedIn}">
     	... a few links
     </c:if>
     <c:if test="${!userData.loggedIn}">
     	<f:verbatim>whatever text for not logged in</f:verbatim>
     </c:if>
</x:panelNavigation>

the jstl is also specified in the web.xml


<taglib>
		<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
		<taglib-location>/WEB-INF/c-rt.tld</taglib-location>
	</taglib>


	<taglib>
		<taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
		<taglib-location>/WEB-INF/c-rt.tld</taglib-location>
	</taglib>


and the affected object is also in my faces-config.xml

<managed-bean>
		<managed-bean-name>userData</managed-bean-name>
		<managed-bean-class>sapjvac.misc.UserData</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
	</managed-bean>


The funny thing is, from myfaces, the bean is called properly,
but it is not accessed by the jstl tags directly. It used to work before 
1.0.9 (probably my mistake)

I must be something missing here.


Re: JSTL-Faces bridge broken?

Posted by Matthias Wessendorf <mw...@gmail.com>.
Werner,

yes JSTL and JSF there are some issues ;)

SPEC tells you more details or a nice article from Hans Bergsten also:
http://www.onjava.com/pub/a/onjava/2004/06/09/jsf.html

but... in JSF spec. 1.2 the things Hans pointed out, are addressed

but they depend on JSP 2.1

HTH,
Matthias


On 4/20/05, Sean Schofield <se...@gmail.com> wrote:
> There are known issues with JSTL and JSF but I am not an expert enough
> at either to say for sure this is your problem.  I take it you are
> aware that you are not really supposed to be mixing the two right?
> The new JSF spec seems to make big strides in that area however.
> 
> sean
> 
> 
> On 4/20/05, Werner Punz <we...@gmx.at> wrote:
> > Hi, I am currently in the migration process
> > from 1.0.9 myfaces RC1 to the final one.
> > I have following construct in my navigation:
> >
> > <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> > <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> > <%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>
> > <%@ taglib prefix="c" uri="/WEB-INF/c-rt.tld" %>
> > <x:panelNavigation id="nav"
> >                styleClass="navigation"
> >
> >                itemClass="navitem"
> >                activeItemClass="navitem_active"
> >                openItemClass="navitem_open"   >
> >      <c:if test="${userData.loggedIn}">
> >         ... a few links
> >      </c:if>
> >      <c:if test="${!userData.loggedIn}">
> >         <f:verbatim>whatever text for not logged in</f:verbatim>
> >      </c:if>
> > </x:panelNavigation>
> >
> > the jstl is also specified in the web.xml
> >
> > <taglib>
> >                 <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
> >                 <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
> >         </taglib>
> >
> >         <taglib>
> >                 <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
> >                 <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
> >         </taglib>
> >
> > and the affected object is also in my faces-config.xml
> >
> > <managed-bean>
> >                 <managed-bean-name>userData</managed-bean-name>
> >                 <managed-bean-class>sapjvac.misc.UserData</managed-bean-class>
> >                 <managed-bean-scope>session</managed-bean-scope>
> >         </managed-bean>
> >
> > The funny thing is, from myfaces, the bean is called properly,
> > but it is not accessed by the jstl tags directly. It used to work before
> > 1.0.9 (probably my mistake)
> >
> > I must be something missing here.
> >
> >
> 


-- 
Matthias Wessendorf

Re: JSTL-Faces bridge broken?

Posted by Craig McClanahan <cr...@gmail.com>.
On 5/4/05, Rob Decker <ro...@objectsource.org> wrote:
>  
> The <c:if> tag and rendered attribute are actually slightly different. 
>   
> This prevents the component from being added to the heirachy: 
>   
> <c:if test="${false}"> 
>     <h:outputText value="hello"/>
> </c:if> 
>   
> This prevents the component from being rendered but it still exists in the
> heirarchy: 
>   
> <h:outputText value="hello" rendered="false"/> 
>   
> I've found <c:if> can be useful because it does that.
>  

One cautionary note -- if you use <c:if> in this manner, components
enclosed within it should ALWAYS have an "id" value.  This avoids
problems when ids are being automatically assigned, you redisplay the
same page, and the IF condition has chaged since when the page was
originally rendered (thus, the component that was omitted before is
now included, or vice versa).

Craig

Re: JSTL-Faces bridge broken?

Posted by Rob Decker <ro...@objectsource.org>.
The <c:if> tag and rendered attribute are actually slightly different.

This prevents the component from being added to the heirachy:

<c:if test="${false}">
    <h:outputText value="hello"/>
</c:if>

This prevents the component from being rendered but it still exists in the heirarchy:

<h:outputText value="hello" rendered="false"/>

I've found <c:if> can be useful because it does that.

----- Original Message ----- 
  From: Werner Punz 
  To: MyFaces Discussion 
  Sent: Tuesday, May 03, 2005 1:47 PM
  Subject: Re: JSTL-Faces bridge broken?


  There are several cases where you can mix and match both.
  c:if is one of them. c:foreach is not.
  but as I said the problem was an old jar which broke things left and right.
  c:if is in most cases unecessary, I replaced my c:if with a rendered attribute
  does the same and does not have to rely on jstl






  Am 20.04.2005 um 16:59 schrieb Sean Schofield:


    There are known issues with JSTL and JSF but I am not an expert enough

    at either to say for sure this is your problem.  I take it you are

    aware that you are not really supposed to be mixing the two right? 

    The new JSF spec seems to make big strides in that area however.





Re: JSTL-Faces bridge broken?

Posted by Werner Punz <we...@gmx.at>.
There are several cases where you can mix and match both.
c:if is one of them. c:foreach is not.
but as I said the problem was an old jar which broke things left and  
right.
c:if is in most cases unecessary, I replaced my c:if with a rendered  
attribute
does the same and does not have to rely on jstl



Am 20.04.2005 um 16:59 schrieb Sean Schofield:

> There are known issues with JSTL and JSF but I am not an expert enough
> at either to say for sure this is your problem.  I take it you are
> aware that you are not really supposed to be mixing the two right?
> The new JSF spec seems to make big strides in that area however.
>


Re: JSTL-Faces bridge broken?

Posted by Sean Schofield <se...@gmail.com>.
There are known issues with JSTL and JSF but I am not an expert enough
at either to say for sure this is your problem.  I take it you are
aware that you are not really supposed to be mixing the two right? 
The new JSF spec seems to make big strides in that area however.

sean


On 4/20/05, Werner Punz <we...@gmx.at> wrote:
> Hi, I am currently in the migration process
> from 1.0.9 myfaces RC1 to the final one.
> I have following construct in my navigation:
> 
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>
> <%@ taglib prefix="c" uri="/WEB-INF/c-rt.tld" %>
> <x:panelNavigation id="nav"
>                styleClass="navigation"
> 
>                itemClass="navitem"
>                activeItemClass="navitem_active"
>                openItemClass="navitem_open"   >
>      <c:if test="${userData.loggedIn}">
>         ... a few links
>      </c:if>
>      <c:if test="${!userData.loggedIn}">
>         <f:verbatim>whatever text for not logged in</f:verbatim>
>      </c:if>
> </x:panelNavigation>
> 
> the jstl is also specified in the web.xml
> 
> <taglib>
>                 <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
>                 <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
>         </taglib>
> 
>         <taglib>
>                 <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
>                 <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
>         </taglib>
> 
> and the affected object is also in my faces-config.xml
> 
> <managed-bean>
>                 <managed-bean-name>userData</managed-bean-name>
>                 <managed-bean-class>sapjvac.misc.UserData</managed-bean-class>
>                 <managed-bean-scope>session</managed-bean-scope>
>         </managed-bean>
> 
> The funny thing is, from myfaces, the bean is called properly,
> but it is not accessed by the jstl tags directly. It used to work before
> 1.0.9 (probably my mistake)
> 
> I must be something missing here.
> 
>

Re: JSTL-Faces bridge broken?

Posted by Matthias Wessendorf <mw...@gmail.com>.
ok,

I think <c:if/> may work

but definitly not <c:forEach/>

-mw-

On 4/21/05, Werner Punz <we...@gmx.at> wrote:
> Guess I have to answer myself, the bridge was not broken, I had an old
> jsf.jar in my web-inf/lib which now is obsolete with myfaces 1.0.9
> 
> 


-- 
Matthias Wessendorf

Re: JSTL-Faces bridge broken?

Posted by Werner Punz <we...@gmx.at>.
Guess I have to answer myself, the bridge was not broken, I had an old 
jsf.jar in my web-inf/lib which now is obsolete with myfaces 1.0.9