Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343387

Summary: JSP Editor shows false error when <h:commandButton> has value="<"
Product: [WebTools] WTP Source Editing Reporter: Jim Tough <jim>
Component: jst.jspAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: carlin.rogers, nsand.dev, raghunathan.srinivasan, thatnitind
Version: 3.2.3Flags: thatnitind: review+
Target Milestone: 3.2.5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch none

Description Jim Tough CLA 2011-04-20 07:54:56 EDT
Build Identifier: 20110218-0911

My project is using JSF inside JSPs. I just added an <h:commandButton> element to an existing page and I want the button text to be << (two less-than symbols). The code snippet from the page looks like this:

<h:commandButton action="#{myBean.actionMethodName} value="<<">

The JSP Editor is now complaining of "No end tag (</h:commandButton>)" and "Start tag (<h:commandButton>) not closed".

If I just ignore that JSP Editor errors, the page executes just fine. It should not be an error since quoted angle brackets are valid in this position. This is a problem for me, since now I have unfixable false errors in the JSP Editor for this page and I won't see real errors.

Reproducible: Always

Steps to Reproduce:
1. Open a JSP page with JSF content in the JSP Editor
2. Add an element similar to <h:commandButton action="#{myBean.actionMethodName} value="<<"> somewhere inside the <h:form> for this page
Comment 1 Carlin Rogers CLA 2011-04-21 01:14:30 EDT
Curious, are the error messages occurring because of a mismatch of quotes for the attribute values? With your example, the action attribute value is without the closing double quote character in the <h:commandButton> tag. The action attribute would be the string literal,
    "#{myBean.actionMethodName} value="

rather than,
    "#{myBean.actionMethodName}"

Does adding the double quote work for you? I was not able to reproduce (other than when the end tags was truly missing) but maybe I'm missing something.
Comment 2 Ian Trimble CLA 2011-04-21 02:26:09 EDT
This:

        <h:commandButton value="<"/>

produces the following marker for me:

        Multiple annotations found at this line:
                - Start tag (<h:commandButton>) not closed properly, expected >.
                - No end tag (</h:commandButton>).


If I add the second angle bracket:

        <h:commandButton value="<<"/>

then I get a second "No end tag (</h:commandButton>)." added to the marker.
Comment 3 Ian Trimble CLA 2011-04-21 02:36:12 EDT
This:

    <jsp:include page="<<"></jsp:include>

produces this marker:

    Start tag (<jsp:include>) not closed properly, expected >.

The difference in the annotations is curious, but I think this shows that at its core, at least, this is not a JSF Tools issue.
Comment 4 Jim Tough CLA 2011-04-22 19:41:27 EDT
Sorry for the typo in my original bug report, the code snippet should read:

<h:commandButton action="#{myBean.actionMethodName}" value="<<">

I missed the closing quote for the action attribute value when I typed it in.
Comment 5 Raghunathan Srinivasan CLA 2011-04-29 19:32:31 EDT
Adding Nick to review if this is an issue with JSP support
Comment 6 Nick Sandonato CLA 2011-05-02 10:10:56 EDT
Yup, this looks to be a problem in our Parser. It looks like we're trying to build up a region for an embedded tag instead of treating it as static content.

I know it's not a pretty work around, but it seems like that if any text is placed after the <, the validation message would go away. So "<&lt;" or "<<&nbsp;" should eliminate the validation message.
Comment 7 Nick Sandonato CLA 2011-05-02 15:18:11 EDT
Created attachment 194531 [details]
patch
Comment 8 Nick Sandonato CLA 2011-05-25 15:06:06 EDT
Code checked in.