You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by netfish <su...@yahoo.com> on 2007/04/25 00:59:26 UTC

According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Hello,
I'm sure i'm missing something basic here.  I have a servlet that puts an
ArrayList into session say "EmployeeList" and this is my JSF snippet..
    <c:forEach var='item' items='${EmployeeList}'>
    <tr>
      <td><h:commandLink action='#{empInfo.getEmployeeInfo}'>
	      <f:verbatim>${item.name}</f:verbatim>
	      <f:param name="empId" value="${item.id}"/>
      </h:commandLink>
      </td>
      </c:forEach>

The EmployeeList has beans with id and name parameters.  I'm trying to post
an Id to the empInfo's getEmployeeInfo action method(empInfo is one of the
managed beans).  All i get is the "According to TLD or attribute directive
in tag file, attribute value does not accept any expressions" exception.  If
i however substitue the value to some static value, then it works just like
i need.  
FYI my tag libs include 
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ 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/tomahawk" prefix="t" %>
and i'm using 1.1 implementation in Tomcat 5.5
Pls let me know if I'm missnig something here!?




-- 
View this message in context: http://www.nabble.com/According-to-TLD-or-attribute-directive-in-tag-file%2C-attribute-value-does-not-accept-any-expressions-tf3642026.html#a10171285
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Posted by netfish <su...@yahoo.com>.
It looks like theres no straightforward way to get session values into JSF
tags atleast in 1.1.  I kinda gave up on this and used a workaround i found
on another site.  
basically just made a URL (using c:url) which passes an id req parameter to
my next page (employee details JSF).  As the first JSF call after f:view
make a dummy call, something like
<h:outputText value="#{employeeData.loadData}" /> 
(method needs to be getLoadData) which will pull up the info i need from
backend.
Sounds clumsy, but it works.  JSF isnt making it very easy either :)
-- 
View this message in context: http://www.nabble.com/According-to-TLD-or-attribute-directive-in-tag-file%2C-attribute-value-does-not-accept-any-expressions-tf3642026.html#a10226729
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Posted by Mike Kienenberger <mk...@gmail.com>.
You might be better off doing something like this:

<t:dataList var="item" value="#{....EmployeeList}">
    <tr>
        <td>
                <h:commandLink action='#{empInfo.getEmployeeInfo}'>
                    <f:verbatim>#{item.name}</f:verbatim>
                    <f:param name="empId" value="#{item.id}"/>
                </h:commandLink>
        </td>
    </tr>
</t:dataList>

This performs the iteration at render time rather than page compile time.

If it were me, I'd also be using t:updateActionListener (or
f:setPropertyActionListener for Facelets/JSF 1.2) to set the value...

                <h:commandLink action='#{empInfo.getEmployeeInfo}'>
                    [...]
                    <t:updateActionListener
property="#{empInfo.employeeId}" value="#{item.id}"/>
                </h:commandLink>


On 4/24/07, netfish <su...@yahoo.com> wrote:
>
> Hello,
> I'm sure i'm missing something basic here.  I have a servlet that puts an
> ArrayList into session say "EmployeeList" and this is my JSF snippet..
>     <c:forEach var='item' items='${EmployeeList}'>
>     <tr>
>       <td><h:commandLink action='#{empInfo.getEmployeeInfo}'>
>               <f:verbatim>${item.name}</f:verbatim>
>               <f:param name="empId" value="${item.id}"/>
>       </h:commandLink>
>       </td>
>       </c:forEach>
>
> The EmployeeList has beans with id and name parameters.  I'm trying to post
> an Id to the empInfo's getEmployeeInfo action method(empInfo is one of the
> managed beans).  All i get is the "According to TLD or attribute directive
> in tag file, attribute value does not accept any expressions" exception.  If
> i however substitue the value to some static value, then it works just like
> i need.
> FYI my tag libs include
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> <%@ 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/tomahawk" prefix="t" %>
> and i'm using 1.1 implementation in Tomcat 5.5
> Pls let me know if I'm missnig something here!?
>
>
>
>
> --
> View this message in context: http://www.nabble.com/According-to-TLD-or-attribute-directive-in-tag-file%2C-attribute-value-does-not-accept-any-expressions-tf3642026.html#a10171285
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Posted by netfish <su...@yahoo.com>.
It looks like theres no straightforward way to get session values into JSF
tags atleast in 1.1.  I kinda gave up on this and used a workaround i found
on another site.  
basically just made a URL (using c:url) which passes an id req parameter to
my next page (employee details JSF).  As the first JSF call after f:view
make a dummy call, something like
<h:outputText value="#{employeeData.loadData}" /> 
(method needs to be getLoadData) which will pull up the info i need from
backend.
Sounds clumsy, but it works.  JSF isnt making it any easy either :)
Thanks Simon/Mike.
-- 
View this message in context: http://www.nabble.com/According-to-TLD-or-attribute-directive-in-tag-file%2C-attribute-value-does-not-accept-any-expressions-tf3642026.html#a10226729
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Posted by Simon Kitching <si...@rhe.co.nz>.
JSF expressions can access stuff in the http session fine.

When expression #{foo} is encountered, JSF does this:
(1) look in the request-scope vars for name "foo"
(2) look in the http-session vars for name "foo"
(3) look in the app-scope vars for name "foo"
(4) look for a managed-bean declaration for "foo" and if found create an 
instance and put it in whatever scope was declared.
(5) report an error

The first 3 steps are identical to the JSP variable lookup. The var 
scopes are the same ones used by JSP. If there is an entry for "foo" in 
the http session then it will be found, regardless of what code put it 
there.

Note however that JSF does not have any equivalent to the JSP "page 
scope". That's a JSP-specific feature that is not in the servlet spec 
and is not accessable to anything other than JSP code.

Regards,

Simon

netfish wrote:
> Simon,
> Thanks for your answer, after reading it and googling around a bit more
> things are getting clearer.  But even with dataList, is it possible at all
> to get a Arraylist object stored in session as its value?  The JSTL tags
> have no issues with this (using ${..}).  The list i'd like to iterate over
> is not a managed bean at this point and its just stored in the session
> scope.
> 
> ---------------------------->>>>>
> Firstly, avoid using c:forEach with JSF1.1. The JSTL tags do NOT work 
> well with JSF in general, and c:forEach is particularly incompatible 
> (this is fixed with JSF1.2 I believe). Use t:dataList instead.
> 
> Secondly, the JSF tags don't accept JSP expressions ("${..}") in 
> attributes, only the JSF "#{...}" form. For example, the 
> myfaces_core.tld file has:
> 
>   <tag>
>    <name>param</name>
>    ....
>    <attribute>
>       <name>value</name>
>       <required>true</required>
>       <rtexprvalue>false</rtexprvalue>
>       <type>java.lang.String</type>
>       <description>The value of this parameter.</description>
>    </attribute>
>   </tag>
> 
> Note that rtexprvalue is false, ie no JSP expressions are permitted.
> 
> However the JSF form #{..} should be able to do what you want. Remember 
> that JSF is not JSP. It's a different way of thinking, and just supports 
> JSP as one of the possible "templating" systems.
> 
> Regards,
> 
> Simon
> 
> 
> 
> 


Re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Posted by netfish <su...@yahoo.com>.
Simon,
Thanks for your answer, after reading it and googling around a bit more
things are getting clearer.  But even with dataList, is it possible at all
to get a Arraylist object stored in session as its value?  The JSTL tags
have no issues with this (using ${..}).  The list i'd like to iterate over
is not a managed bean at this point and its just stored in the session
scope.

---------------------------->>>>>
Firstly, avoid using c:forEach with JSF1.1. The JSTL tags do NOT work 
well with JSF in general, and c:forEach is particularly incompatible 
(this is fixed with JSF1.2 I believe). Use t:dataList instead.

Secondly, the JSF tags don't accept JSP expressions ("${..}") in 
attributes, only the JSF "#{...}" form. For example, the 
myfaces_core.tld file has:

  <tag>
   <name>param</name>
   ....
   <attribute>
      <name>value</name>
      <required>true</required>
      <rtexprvalue>false</rtexprvalue>
      <type>java.lang.String</type>
      <description>The value of this parameter.</description>
   </attribute>
  </tag>

Note that rtexprvalue is false, ie no JSP expressions are permitted.

However the JSF form #{..} should be able to do what you want. Remember 
that JSF is not JSP. It's a different way of thinking, and just supports 
JSP as one of the possible "templating" systems.

Regards,

Simon




-- 
View this message in context: http://www.nabble.com/According-to-TLD-or-attribute-directive-in-tag-file%2C-attribute-value-does-not-accept-any-expressions-tf3642026.html#a10225815
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Posted by Simon Kitching <si...@rhe.co.nz>.
netfish wrote:
> Hello,
> I'm sure i'm missing something basic here.  I have a servlet that puts an
> ArrayList into session say "EmployeeList" and this is my JSF snippet..
>     <c:forEach var='item' items='${EmployeeList}'>
>     <tr>
>       <td><h:commandLink action='#{empInfo.getEmployeeInfo}'>
> 	      <f:verbatim>${item.name}</f:verbatim>
> 	      <f:param name="empId" value="${item.id}"/>
>       </h:commandLink>
>       </td>
>       </c:forEach>
> 
> The EmployeeList has beans with id and name parameters.  I'm trying to post
> an Id to the empInfo's getEmployeeInfo action method(empInfo is one of the
> managed beans).  All i get is the "According to TLD or attribute directive
> in tag file, attribute value does not accept any expressions" exception.  If
> i however substitue the value to some static value, then it works just like
> i need.  
> FYI my tag libs include 
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> <%@ 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/tomahawk" prefix="t" %>
> and i'm using 1.1 implementation in Tomcat 5.5
> Pls let me know if I'm missnig something here!?
> 

Firstly, avoid using c:forEach with JSF1.1. The JSTL tags do NOT work 
well with JSF in general, and c:forEach is particularly incompatible 
(this is fixed with JSF1.2 I believe). Use t:dataList instead.

Secondly, the JSF tags don't accept JSP expressions ("${..}") in 
attributes, only the JSF "#{...}" form. For example, the 
myfaces_core.tld file has:

  <tag>
   <name>param</name>
   ....
   <attribute>
      <name>value</name>
      <required>true</required>
      <rtexprvalue>false</rtexprvalue>
      <type>java.lang.String</type>
      <description>The value of this parameter.</description>
   </attribute>
  </tag>

Note that rtexprvalue is false, ie no JSP expressions are permitted.

However the JSF form #{..} should be able to do what you want. Remember 
that JSF is not JSP. It's a different way of thinking, and just supports 
JSP as one of the possible "templating" systems.

Regards,

Simon


Re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Posted by netfish <su...@yahoo.com>.
It looks like theres no straightforward way to get session values into JSF
tags atleast in 1.1.  I kinda gave up on this and used a workaround i found
on another site.  
basically just made a URL (using c:url) which passes an id req parameter to
my next page (employee details JSF).  As the first JSF call after f:view
make a dummy call, something like
<h:outputText value="#{employeeData.loadData}" /> 
(method needs to be getLoadData) which will pull up the info i need from
backend.
Sounds clumsy, but it works.  JSF isnt making it any easy either :)
-- 
View this message in context: http://www.nabble.com/According-to-TLD-or-attribute-directive-in-tag-file%2C-attribute-value-does-not-accept-any-expressions-tf3642026.html#a10226729
Sent from the MyFaces - Users mailing list archive at Nabble.com.