This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 139380 - incorrect error marks when mixing jsp tags and scriptlets
Summary: incorrect error marks when mixing jsp tags and scriptlets
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 6.x
Hardware: Sun All
: P3 blocker with 1 vote (vote)
Assignee: issues@javaee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-09 12:09 UTC by Jindrich Sedek
Modified: 2015-09-17 13:10 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jindrich Sedek 2008-07-09 12:09:03 UTC
create new WebApplication
enable jsps compilation during build in project properties/compilation
replace the code of jsp page with this code:
---------------
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:if test="${globalData != null}" >
    <%
            Object data = pageContext.getAttribute("globalData");
    %>
</c:if>
<c:if test="${userData != null}" >
    <%
            Object data = pageContext.getAttribute("userData");
    %>
</c:if>
--------------
error is marked in editor - multiple variable declaration
invoke build -> everythink is Ok, use run -> code si running correctly


try to make the code correct as supposed by netbeans -> remove "Object" data declaration
run build -> compilation error

use view servlet action to see the reason of the problem:
"<c:if" tag is translated into "if {" block in java and so both declarations are in different java blocks
Comment 1 Tomasz Slota 2008-07-17 09:55:10 UTC
Confirmed, unfortunately it will be quite a bit of work to fix it properly.
Comment 2 Tomasz Slota 2008-09-23 14:15:21 UTC
We had a small brainstorming session on this bug with ppisl, mfukala and jsedek and we agreed on the following:

- the priority of this bug is P3
- the proper fix would require a huge rewrite in the infrastructure and there is no guarantee it would work
- we will have to live with this problem in 6.5
Comment 3 Anton Chechel 2011-04-28 13:33:38 UTC
Product Version: NetBeans IDE Dev (Build 20110411-95fa2f6ba3a6)
Java: 1.6.0_23; Java HotSpot(TM) 64-Bit Server VM 19.0-b09
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Userdir: C:\Projects\netbeans\web-main\nbbuild\testuserdir

"Try to make the code correct as supposed by netbeans -> remove "Object" data
declaration run build -> compilation error" - is on longer actual. It compiles fine in current version. Actually both of data variables are now located in different if blocks inside _jspService() method.

The only issue left is: in editor second "data" variable should not be marked as error "is already defined in mergedScriptlets()". Actually there is no mergedScriptlets() method in jasper generated classes anymore. It looks like SimplifiedJspServlet should be rewritten accordingly to new jasper behaviour.
Comment 4 Marek Fukala 2013-01-03 10:47:36 UTC
I do not remember the result of little brainstorming we had few years ago, but definitively this issue cannot be fixed ever :-).

As the resulting java code is built in the runtime upon some external input it is not possible to correctly resolve it in the design time.

The best solution to me seems to add an error fix for the errors which would allow to disable the checking for this file/folder/project.
Comment 5 Martin Balin 2015-09-17 13:10:13 UTC
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.