Bug 107138 - [content assist] Offer content assist and validation for custom tags in attribute values
Summary: [content assist] Offer content assist and validation for custom tags in attri...
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 1.0   Edit
Hardware: PC All
: P2 normal with 1 vote (vote)
Target Milestone: 3.2 M7   Edit
Assignee: Ian Tewksbury CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on: 258999 293099
Blocks:
  Show dependency tree
 
Reported: 2005-08-16 13:42 EDT by Edson Richter CLA
Modified: 2010-04-02 11:56 EDT (History)
4 users (show)

See Also:
nsand.dev: review+


Attachments
Fix Patch (19.36 KB, patch)
2009-10-22 11:57 EDT, Ian Tewksbury CLA
no flags Details | Diff
Fix Patch Update 1 (16.36 KB, patch)
2009-11-04 13:34 EST, Ian Tewksbury CLA
no flags Details | Diff
Fix Patch Update 2 (14.19 KB, patch)
2009-12-02 10:46 EST, Ian Tewksbury CLA
no flags Details | Diff
Fix Patch with JUnits (2.51 KB, patch)
2010-03-15 17:04 EDT, Ian Tewksbury CLA
nsand.dev: iplog+
Details | Diff
JUnit ZIP update (133.73 KB, application/x-zip-compressed)
2010-03-15 17:09 EDT, Ian Tewksbury CLA
nsand.dev: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Edson Richter CLA 2005-08-16 13:42:47 EDT
declared a taglib at .jsp page, but no code completion neither validation of
attributes of tag are offered by editor.

Example of source code:

<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%>

<c:if test="${true}">
  Ok!
</c:if>
Comment 1 Nitin Dahyabhai CLA 2005-08-16 19:25:28 EDT
Where is the standard.jar located and where is the .jsp located?
Comment 2 Edson Richter CLA 2005-08-18 00:33:47 EDT
I have several .jsp files under WebContent and sub-folders inside my project.
None recognize JSTL tags.
standard.jar is at WebContent/WEB-INF/lib folder.
Comment 3 Edson Richter CLA 2005-08-20 13:37:41 EDT
Researching more, I observed JSTL tags are recognized if they are only used
inside and HTML tag.
The example in original message on bug request is wrong. A correct example where
JSTL auto complete and validation doesn't work is:

<a href='<c:url value="/protected/test/index.jsp"/>'>Click here!</a>

Sorry by the first wrong sample, I realize that a wrong sample make you research
much more than necessary :(

Richter
Comment 4 srikanth CLA 2005-08-23 20:48:55 EDT
Doesn't recognise JSTL tags 

Setup..
  All the jstl jars are in WEB-INF/lib
  All the tlds are in WEB-INF
And JSP is in Parent folder of WEB-INF

I'm encountering 
org.apache.jasper.JasperException: /jstl4.jsp(25,4) According to TLD or 
attribute directive in tag file, attribute value does not accept any expressions

Jsp is simple.It gives me error at <c:out

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
..
..
..
<c:set var="hello" value="JSTL Done!"/>
<c:out value="${hello}"/>
 


(In reply to comment #3)
> Researching more, I observed JSTL tags are recognized if they are only used
> inside and HTML tag.
> The example in original message on bug request is wrong. A correct example 
where
> JSTL auto complete and validation doesn't work is:
> <a href='<c:url value="/protected/test/index.jsp"/>'>Click here!</a>
> Sorry by the first wrong sample, I realize that a wrong sample make you 
research
> much more than necessary :(
> Richter

(In reply to comment #3)
> Researching more, I observed JSTL tags are recognized if they are only used
> inside and HTML tag.
> The example in original message on bug request is wrong. A correct example 
where
> JSTL auto complete and validation doesn't work is:
> <a href='<c:url value="/protected/test/index.jsp"/>'>Click here!</a>
> Sorry by the first wrong sample, I realize that a wrong sample make you 
research
> much more than necessary :(
> Richter

Comment 5 Edson Richter CLA 2005-08-23 22:52:01 EDT
The correct uri for taglib isn't "http://java.sun.com/jsp/jstl/core" (I'm
supposing you are using jstl 1.1 - as I am). I don't remember well, but
"http://java.sun.com/jstl/core" doesn't allow scriplets everywhere (and is jstl
1.0 based, could someone confirm this?).

AFAIK, there is no need to declare jstl tags in web.xml. Putting the
standard.jar and jstl.jar in WEB-INF/lib folder does the job (at last, I've been
working in this way for a long time, without any problems at all).


(In reply to comment #4)
> Doesn't recognise JSTL tags 
> 
> Setup..
>   All the jstl jars are in WEB-INF/lib
>   All the tlds are in WEB-INF
> And JSP is in Parent folder of WEB-INF
> 
> I'm encountering 
> org.apache.jasper.JasperException: /jstl4.jsp(25,4) According to TLD or 
> attribute directive in tag file, attribute value does not accept any expressions
> 
> Jsp is simple.It gives me error at <c:out
> 
> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
> ..
> ..
> ..
> <c:set var="hello" value="JSTL Done!"/>
> <c:out value="${hello}"/>
Comment 6 Edson Richter CLA 2006-01-10 09:47:52 EST
Still not work on 1.0. A better use case for this problem is:

<img src='<c:

Then type "ctrl+space" and nothing is suggested.
I think is because the "<c:url" I'm trying to type is under ' (apostrophes).
Comment 7 Edson Richter CLA 2006-01-10 09:48:26 EST
Changed to 1.0, because this doesn't work on 0.7 neither 1.0.
Comment 8 Nitin Dahyabhai CLA 2009-04-06 09:32:07 EDT
(In reply to comment #4)
> org.apache.jasper.JasperException: /jstl4.jsp(25,4) According to TLD or 
> attribute directive in tag file, attribute value does not accept any expressions
This is an error reported by the server.

I'm changing this to an enhancement because it's functionality missing from custom tags within an attribute value, and I suspect that the tags are recognized otherwise in more current releases.
Comment 9 Ian Tewksbury CLA 2009-10-22 11:57:30 EDT
Created attachment 150268 [details]
Fix Patch

Patch cleans up the way content assist is given in attribute value regions.

Patch results:
* Custom tags will now be proposed in attribute value regions

* in the case of:
<img align="
** enumerated values and custom tags will be proposed (before neiter were proposed because of the complications of not having the attribute value region closed
Comment 10 Ian Tewksbury CLA 2009-11-04 13:34:35 EST
Created attachment 151343 [details]
Fix Patch Update 1

The last patch accidentally also included the patch for Bug 292765.
Comment 11 Ian Tewksbury CLA 2009-12-02 10:46:24 EST
Created attachment 153604 [details]
Fix Patch Update 2

Updated the patch again to deal with more conflicting changes that have already gone in.

Also there was an issue with the include options on the ModeqlQuery call, it was 0 for some reason and it really needed to be ModelQuery.INCLUDE_ALL
Comment 12 Ian Tewksbury CLA 2010-01-25 13:14:34 EST
Comment on attachment 153604 [details]
Fix Patch Update 2

This patch has become stale but I have incorporated it into the fix for Bug 258999.
Comment 13 Ian Tewksbury CLA 2010-01-25 13:15:41 EST
Rather then fix this twice, I will just wait for the fix for Bug 258999 to get in and then verify this bug afterwords.
Comment 14 Ian Tewksbury CLA 2010-03-15 16:03:31 EDT
(In reply to comment #13)
> Rather then fix this twice, I will just wait for the fix for Bug 258999 to get
> in and then verify this bug afterwords.

Unfortunately it would seem part of the fix that was needed for this did not make it into Bug 258999.  Will attach needed patch.
Comment 15 Ian Tewksbury CLA 2010-03-15 16:14:59 EDT
It turns out the fix for this was originally in the patch for Bug 258999 but it got removed near the end of the iteration of the patch because it was not known why it was in there.  Now we know.  The problem is that HTMLModelQueryImpl#getAvailableContent gets a class cast exception on line 88 

CMElementDeclaration candidate = (CMElementDeclaration) candidates.elementAt(i);

The candidate at fault is a org.eclipse.wst.html.core.internal.contentmodel.HTMLAttrDeclImpl.

Patch to follow.

Nitin, I am CCing you on this because you are the one who asked I remove it from Bug 258999 because at the time I could not explain why it was there other then to say, if I put it in there it was for some specific case, well I found the case :)
Comment 16 Ian Tewksbury CLA 2010-03-15 17:04:34 EDT
Created attachment 162108 [details]
Fix Patch with JUnits

This has the patch and a new JUnit to test for regression.  Test needs update to test zip file which I will attach separately.
Comment 17 Ian Tewksbury CLA 2010-03-15 17:09:09 EDT
Created attachment 162110 [details]
JUnit ZIP update

This is a new JSP content assist testing zip to go in org.eclipse.jst.jsp.ui.tests/projecttestfiles/TestJSPContentAssistComputers.zip
Comment 18 Nick Sandonato CLA 2010-04-02 11:56:34 EDT
With the addition of the new cycling proposal list, we'd have a regression without this patch. Reason being is that there was nothing guarding against non-CMElementDeclarations coming through. As a byproduct of the implementation of content assist cycling and the general fix to check for the declaration type, this should be resolved.

I'm approving after a tweak to remove the unnecessary else clause.