Community
Participate
Working Groups
I found a problem with some of my pages where imports weren't being found. I turns out that the problem was the formatting of the import tags. In the include file the imports were formatted like this: <%@ page import="java.io.*" %><%@ page import="java.net.*" %><%@ page import="java.util.*" %><%@ page import="java.sql.*" %> The problem was fixed by formatting the imports like this: <%@page import="java.io.*" %> <%@page import="java.net.*" %> <%@page import="java.util.*" %> <%@page import="java.sql.*" %> I bet there there is a regex somewhere that needs to be tweeked.
This bug, or at least remains of it, still exist in WTP 1.0-M4. Page and Include directives that are immediately followed by other directives or scriptlets (without whitespace in between) are not properly "inherited" if you include the jsp that contains them. The following example compiles and runs fine on tomcat, but the jsp-editor complains that - in including.jsp: "The method format(int) is undefined..." - in included.jsp: ParseException cannot be resolved to a type (in file: "nested.jsp") Both errors disappear if I put some whitespace after the directive, but there are many situations where you can't accept whitespace at the beginning of your jsp output. nested.jsp: <%@ page import="java.text.ParseException" %><%! private java.text.NumberFormat currencyFormat = java.text.NumberFormat.getCurrencyInstance(); public String formatCurrency(double value) throws ParseException { return currencyFormat.format(value); } %> included.jsp: <%@ include file="nested.jsp" %><%! // Imagine more stuff here %> including.jsp: <%@ include file="included.jsp" %><% out.println(formatCurrency(100)); %>
Is it that the JSPIncludeRegionHelper.isJSPStartRegion() returns true for jsp_directive_open, preventing processOtherRegions() from being called and nesting the includes properly?
Changed Version field given new release numbering.
This bug still exists in M5 and I20050708. Here is a "minimal" implementation to demonstrate the bug: ---------include.jsp---------- <%@page import="java.util.Vector" %><% Vector v = new Vector(); %> ------------------------------ -----------page.jsp----------- <%@include file="include.jsp" %> ------------------------------ The JSP editor indicates an error in the include statement in page.jsp with the message "Vector cannot be resolved to a type (in file: "include.jsp")".
Reproduced. It happens consistently as long as the directive and scriptlet in include.jsp have no separating whitespace.
This is a bug in XMLJSPRegionHelper#nodeParsed() The logic always assumes a tag that we want to translate is followed by content (xml content or jsp content). This it true for scriptlets, expressions and declarations, but not for page directives, jsp:useBean, and includes. If we move the logic for those cases to the "if" part of the block above where it currently is (below where code handles recognizing the tagname) that should fix the problem. This would be a good candidate for a unit test as well.
fix tested and released to HEAD.
This change is a bulk update of all _un_targeted, fixed, resolved bugs upon release of M5. This particular bug _might_ have been fixed earlier than M5. (Feel free to correct).
closing