dev@jsftemplating.java.net

[Issue 5] New - SyntaxException is thrown when there is space between "if( ... #"

From: <anilam_at_dev.java.net>
Date: 4 Nov 2006 17:09:03 -0000

SyntaxException is thrown when there is space between "if( ... #":
https://jsftemplating.dev.java.net/issues/show_bug.cgi?id=5
                 Issue #|5
                 Summary|SyntaxException is thrown when there is space between
                        |"if( ... #"
               Component|jsftemplating
                 Version|current
                Platform|Windows
              OS/Version|All
                     URL|
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|Templating Format
             Assigned to|kenpaulsen
             Reported by|anilam






------- Additional comments from anilam_at_dev.java.net Sat Nov 4 17:09:02 +0000 2006 -------
SyntaxExecption is thrown by the parser for the following line:
if ( #{flag}){ doSomething() }

The problem is the space between if( an the # char.
Parser skips comments and white space after the opening parenthesis in "if ( ..."
and the '#' character is a comment.

To work around the problem:

Replace "attribute" with "pageSession"; "session"; or whatever you need...

OR, you can do:

    if ("#{flag}") { doSomething() }

OR even:

    if (condition="#{flag}") { doSomething() }

FYI, the "if" functionality is implemented as a handler with a single input value called
"condition". Using it w/o quotes or a parameter name is a convenience feature.


[#|2006-11-03T15:27:57.728-0800|SEVERE|sun-appserver-ee9.1|javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=httpWorkerThread-8080-0;_RequestID=90a839d0-b762-40eb-9e8f-6af0041804bd;|StandardWrapperValve[FacesServlet]:
PWC1406: Servlet.service() for servlet FacesServlet threw exception
com.sun.jsftemplating.layout.SyntaxException: Encountered unmatched '}' when parsing handlers for 'command' event.
        at com.sun.jsftemplating.layout.template.TemplateReader$EventParserCommand.process(TemplateReader.java:762)
        at com.sun.jsftemplating.layout.template.BaseProcessingContext.beginSpecial(BaseProcessingContext.java:122)
        at com.sun.jsftemplating.layout.template.TemplateReader$LayoutComponentContext.beginSpecial(TemplateReader.java:723)
        at com.sun.jsftemplating.layout.template.TemplateReader.process(TemplateReader.java:262)