History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-20900
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Dmitry Avdeev
Reporter: Mike Hanafey
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

In JSF tag attributes must generally be deferred value expressions, but IDEA does not flag as error immediate evaluation expressions.

Created: 10 Sep 07 18:18   Updated: 01 Dec 07 14:17
Component/s: Editor. Error Highlighting
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 7,126
Severity: Medium


 Description  « Hide
As an example, IDEA does not flag the outputText value attribute as an error, but in fact the TLD states that the attribute must be a deferred value expression, and so now this typo comes to light when the app is deployed, instead of being immediately flagged:
<f:view>
  <h:outputText value="${managedBean.prop}"/>  <!-- Should be flagged -->
  <h:outputText value="#{managedBean.prop}"/>  <!-- This is correct -->
</f:view>


 All   Comments   Work Log   Change History      Sort Order:
NNTP User - 10 Sep 07 21:22
In JSF 1.2 and unified EL it does not matter, right?
So please let this inspection fire only for JSF 1.1 (or more likely it is depending on the JSP version).

Mike Hanafey - 11 Sep 07 00:37
Using JSP 1.2 (via Glassfish Sun Java System Application Server 9.1 (build b58c-fcs)), the following JSF is not flagged with any error by IDEA:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<jsp:useBean id="simple" class="genomix.play.Simple"/>
<f:view>
    <h:panelGrid >
        <h:outputText value="#{simple.address}"/>
        <h:outputText value="${simple.address}"/>
        <h3>${simple.address}</h3>
    </h:panelGrid>
</f:view>

When it is run the following exception is reported: org.apache.jasper.JasperException: /user/label.jsp(8,8) PWC6313: According to the TLD, the attribute value is a deferred-value or deferred-method, but the specified value contains a $-expression.

The TLD version 1.2 states that the value attr of outputText must be deferred value expression, so IDEA should flag <h:outputText value="${simple.address}"/> as a syntax error even for JSP 1.2


NNTP User - 11 Sep 07 01:04
I was talking about JS_F_ 1.2 which should be used in conjunction with JSP 2.1.

JS_P_ 1.2 is quite outdated.


Mike Hanafey - 11 Sep 07 15:40
Sorry – just a typo – where I wrote JSP I really meant JSF. The TLD referred to is the version 1.2 http://java.sun.com/jsf/html.

Mike Hanafey - 13 Sep 07 17:34
In a similar vein, in JSF 1.2 the use of deferred evaluation mode for the "id" attribute below should be flagged as an error:
<h:inputText id="#{wrong}" value=.../>
<h:inputText id="${okayButStrange}" value=.../>

In the fragment below using an immediate evaluation on "items", and then trying to use the "var" in deferred mode is wrong, and it would be nice if IDEA could flag this issue. Basically it appears that with the JSTL iterator either deferred or immediate on the attributes "items" and "var" is okay, but not a mixture:

<ol>
         <c:forEach items="${simple.states}" var="state">
                <li><h:inputText  value="#{state}"/></li>
          </c:forEach>
</ol>

Maxim Mossienko - 13 Nov 07 22:29
AFAIK only JSF RI taglig descriptor (tld) has information about the validation you are asking for and this seriously complicates the problem