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 269504 - Netbeans 8.2 'cannot find symbol' error on variable from another <%@ include file
Summary: Netbeans 8.2 'cannot find symbol' error on variable from another <%@ include ...
Status: NEW
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 8.2
Hardware: PC Windows 10 x64
: P1 normal with 3 votes (vote)
Assignee: issues@javaee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-07 20:35 UTC by tlf30
Modified: 2017-10-09 16:00 UTC (History)
0 users

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 tlf30 2017-01-07 20:35:29 UTC
This error appears to be the same as a resolved error for 8.0, see bug 246249

What happens:
If I have a file, lets say index.jsp, and two more files f0.jspf, f1.jspf. If I include f0.jspf and f1.jspf inside my index.jsp, any variables from f0.jspf are not visible from f1.jspf, but vars from f0.jspf are visible inside index.jsp according to netbeans 8.2, but it compiles and run just fine, tested on wildfly 10.

See code:
f0.jspf:
<%@ page pageEncoding="UTF-8" %>
<%
    String someString = "Hello";
%>

f1.jspf
<%@ page pageEncoding="UTF-8" %>
<%
    out.println(someString); //This is what netbeans says does not exists
%>

index.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="WEB-INF/f0.jspf" %>
<%@include file="WEB-INF/f1.jspf" %>
<%
    out.println(someString);
%>

This has been very easy to reproduce, New Project -> Java Web -> Web Application
create files f0.jspf and f2.jspf inside WEB-INF, create file index.jsp (after removing index.html that was auto-created). Copy and past the code above for each file respectively. Run it and you should see 'Hello Hello' in your browser.  

I hope this is an easy fix!
Thank you,
Trevor Flynn
Comment 1 DKK_PUB 2017-02-03 18:28:29 UTC
This bug is completely defeating the "Test compile all JSP files during builds" option on the Project Properties->Build->Compiling page.

I can manually select JSPs and compile them individually, but for a large complex system this is not practical at all. Neither is just deploying and seeing what goes bang ;)

Seems like this should be higher than a P3 defect.
Comment 2 tlf30 2017-02-04 06:24:53 UTC
DKK_PUB, I agree completely, I already have two very large projects where this has become a problem.
Comment 3 eta 2017-09-26 17:58:13 UTC
tlf30, this isn't seem to be an easy fix!
Comment 4 tlf30 2017-10-09 15:57:37 UTC
(In reply to eta from comment #3)
> tlf30, this isn't seem to be an easy fix!

It would not be too bad. When NetBeans is looking for a varible to be declared, it needs to look at the included jspf files to see if any variables declared in them. And it should probably give a warning about bad practice that we can disable :)
Comment 5 tlf30 2017-10-09 16:00:03 UTC
(In reply to tlf30 from comment #4)

For the resolution of the variable in f1.jspf, lookup usage cases and then perform the same check.