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

Bug 181228

Summary: [content assist] Extra < in JSP content assist
Product: [WebTools] WTP Source Editing Reporter: David Klein <kleind>
Component: jst.jspAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: minor    
Priority: P3 CC: david_williams, itewksbu, mauromol, nsand.dev, rpastran
Version: 2.0Keywords: helpwanted
Target Milestone: 3.4.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description David Klein CLA 2007-04-05 11:40:13 EDT
Build ID: WTP 2.0 M5

Steps To Reproduce:
1.Enter an angle bracket, <, within the html content of a JSP page.
2.Content assist is displayed.
3.Select the JSP expression <%= %>
4.The content assist ignores the original < which causes the following content in the JSP:
<<%= %>


More information:
The extra angle bracket occurs in various other scenarios.  Another case is selecting JSP taglib directive, which yields:
<<%@ taglib uri="" prefix="" %>
Comment 1 Nitin Dahyabhai CLA 2007-09-12 15:42:04 EDT
With just the '<' present, it looks like improper filtering of proposals for the tag name.  Once a character has been typed, something else is going on.  Marking it for Future as we don't have time to work on it right now, but will see if we can find time later in the schedule.
Comment 2 Rodrigo Pastrana CLA 2008-03-17 16:25:55 EDT
(In reply to comment #1)
> With just the '<' present, it looks like improper filtering of proposals for
> the tag name.  Once a character has been typed, something else is going on. 
> Marking it for Future as we don't have time to work on it right now, but will
> see if we can find time later in the schedule.

Hi, can we have an update on this bug? Has it made it into the schedule? Thanks.
Comment 3 David Williams CLA 2008-03-19 04:22:07 EDT
Since it was marked as "helpwanted", that's a good indication that the current core team would look at a patch, if someone provided one, but otherwise wouldn't have time. 



Comment 4 Nitin Dahyabhai CLA 2008-04-15 22:19:04 EDT
Thanks, David.  It is as he says.
Comment 5 Ian Tewksbury CLA 2010-01-27 11:16:42 EST
This is still present in 3.2
Comment 6 Sarika Sinha CLA 2010-10-19 07:17:07 EDT
This is happening because unlike other content assist proposal, JSP Expression comes from JSP template. So if we type "JSP" or any substring from JSP template name ,and hit the content assist and select the JSP Expression proposal. It will correctly replace "JSP" to <%= >

This happens for all templates. I guess this is works as designed.

Currently templates are case sensitive. I have created bug 328110.
Comment 7 Nick Sandonato CLA 2012-09-24 17:27:37 EDT
Sarika is correct that since < is not part of the name, it wil not be replaced by the template. This is how the template proposals work.
Comment 8 Mauro Molinari CLA 2012-09-25 02:19:19 EDT
IMHO this is not enough to close this bug.
The JSP expression proposal is in the list of the "default" proposals, together with the HTML proposals.

In other words, if you type:
<
and invoke code completion, you are suggested:
<a>
<abbr>
[...]
JSP expression (<%=..>)

All the proposals work fine, except for the JSP expression one.
Why doesn't the JSP expression work like the others?

If the problem is that the name of the suggested proposal is "JSP expression" and not "<%=", then you should either:
1. change the name of the proposal
or
2. remove the JSP expression from the proposals, since you started typing a character which is not the start of the name of the proposal
Since I think 2. is not a so smart solution, why not changing the proposal name to "<%="?
Comment 9 Nick Sandonato CLA 2012-09-25 13:40:41 EDT
Hi Mauro,

Thanks for your feedback. So I ended up reworking our JSPTemplateCompletionProcessor so that it will check and see if it can consume the previous bit of text due to it opening a JSP expression tag. The changes have been pushed to get git repository.
Comment 10 Mauro Molinari CLA 2012-09-25 13:52:49 EDT
Thanks to you Nick!