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 112247 - Java objects declared in included JSP fragments are not visible
Summary: Java objects declared in included JSP fragments are not visible
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P2 blocker with 1 vote (vote)
Assignee: Tomasz Slota
URL:
Keywords:
: 121065 (view as bug list)
Depends on:
Blocks: 115852
  Show dependency tree
 
Reported: 2007-08-07 21:56 UTC by shannonbrown
Modified: 2008-11-03 16:56 UTC (History)
1 user (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 shannonbrown 2007-08-07 21:56:08 UTC
Testing:
NB 6.0M10
included Tomcat 6
Issue occurs: 
Empty web project created.
Existing web project "imported"

Issue:
Page B is a simple JSP file named b.jsp.
<%
     String MYTEST = "OK" ;
%>


Page A is a simple JSP Page named A.jsp that INCLUDES Page B.
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@include file="b.jsp" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>

    <h1>JSP Page</h1>
    <%= MYTEST %>
.... rest of file

In the NB 6M10 IDE, any reference to information contained in the included file (using either the include directive or 
jsp:include model) results in an error condition:
cannot find symbol
symbol: variableMYTEST
location: class SimplifiedJSPServlet

The issue makes working with JSP pages very difficult as each page indicates numerous errors depending on the 
inclusion requirements.

The files compile fine under NB6M10 and deploy fine under the included Tomcat 6 instance. The issues seems to lie with 
the editor-coding model.

(For comparison: The include works fine in NB 5.5.1.)
Comment 1 Marek Fukala 2007-08-08 09:39:04 UTC
The generated virtual servlet file provided to java infrastructure likely doesn't take the inclusion into account.
Comment 2 Tomasz Slota 2007-08-08 14:39:25 UTC
Confirmed. The scenario you described should be definitely handled properly but I don't think we can fix the opposite situation (where B is referring to objects 
defined in A) /is it legal at all?/. We should also define the behavior in case the included file contains compilation errors.

Note that we had no support for showing compilation errors in JSP scriptlets prior to 6.0.
Comment 3 _ manoelp 2007-10-25 16:01:44 UTC
Excuse me, 

There is some idea of how to fix it? 

In version 5.5, used much this feature, therefore, I believe that this is of extreme importance to the users of 
NetBeans. 

Tks,
Comment 4 Tomasz Slota 2007-10-25 16:50:45 UTC
Fixed in trunk.

Checking in SimplifiedJSPServlet.java;
/cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/SimplifiedJSPServlet.java,v  <--  SimplifiedJSPServlet.java
new revision: 1.25; previous revision: 1.24
done
Comment 5 Tomasz Slota 2007-11-03 20:57:49 UTC
*** Issue 121065 has been marked as a duplicate of this issue. ***
Comment 6 shannonbrown 2007-11-05 14:25:55 UTC
Thank you for the hard work. However, I do not believe this issue is resolved.

Using NetBeans 6.0 200711021200

Assume the following:
/index.jsp ---> a root level file
/res/all.jsp ---> the file to be included
/somesubdirectory/myapp.jsp ----> a subdirectory jsp file

Now, if index.jsp includes /res/all.jsp, the issue reported does appear to be resolved.
<%@include file="/res/all.jsp" %>

HOWEVER, if /somesubdirectory/myapp.jsp includes /res/all.jsp, THE ISSUE REMAINS. That is, the fix does not appear to 
apply when including the common file from a subdirectory.
<%@include file="../res/all.jsp" %>
I tested this again this morning, and the IDE does not 'see' the include file in the latter situation. The IDE reports 
numerous errors in the 'calling' file (ex. myapp.jsp) just as before when referencing any common elements in the 
intended include file (all.jsp).






Comment 7 Tomasz Slota 2007-11-05 15:15:23 UTC
I didn't imagine org.openide.filesystems.FileObject would not handle '../' in relative paths.. I am now using java.io.File, the problem has been resolved.

/cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/SimplifiedJSPServlet.java,v  <--  SimplifiedJSPServlet.java
new revision: 1.34; previous revision: 1.33
Comment 8 Tomasz Slota 2008-10-01 09:15:09 UTC
*** Issue 148606 has been marked as a duplicate of this issue. ***
Comment 9 martin_zmrhal 2008-11-03 16:56:33 UTC
verified

Product Version: NetBeans IDE Dev (Build 200811011401)
Java: 1.6.0_10-rc2; Java HotSpot(TM) Client VM 11.0-b15
System: Linux version 2.6.24-21-generic running on i386; UTF-8; en_US (nb)