facebook

project dependant imports error in jsp inc and jspf files

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #238680 Reply

    Sam
    Participant

    I have Eclipse Platform version 3.1.0 Build Id: I20050617-1618 My Eclipse 4.0.1 GA Build Id 20050930-4.0.1-GA and the problem is i have a dependant project where all the class files are and the jsp project which uses them.
    Our jsp pages does static includes of inc files (declared as jsp fragments in the My Eclipse configuration) in the inc files we do import some classes in the dependant project.
    on the main jsp we see an annotation on the right side the annotation says couldn’t find class that is imported in the include file.

    The annotation read ServerConfig cannot be resolved, ServerConfig class is not used in this page but used in the include page
    the include page has this line at the begining
    <%@ page import = “com.eggtheory.brainfuse.server.*” %><%@ page import = “com.eggtheory.brainfuse.web.common.SiteConstants” %><%!
    /// Some declarations %>

    <%
    // Some code
    %>

    The odd thing is that when editing the include file I get Code Insight for ServerConfig and other classes that the ide is complaining about.

    I tried the workaround of adding the bin directory but that didn’t work

    #238690 Reply

    Riyad Kalla
    Member

    I have Eclipse Platform version 3.1.0 Build Id: I20050617-1618

    Sam,
    this isn’t the final GA release of Eclipse, if it’s not too much trouble please redownload Eclipse 3.1 SDK GA and use that, you are only off with that build by a week or two, but we’ve had that small of a change fix ap roblem before.

    Also please clarify this sentence:

    i have a dependant project where all the class files are and the jsp project which uses them.

    Preferably with a diagram of your project(s) setups and what’s in them, please use the code button below to maintain formatting.

    #238699 Reply

    Sam
    Participant

    Basically what I have is project Jsp which is a web project that is dependant on project JavaServer this is where all the source code is for the *.java files.
    JavaServer project is part of the Build Path of the JSP Project.
    JSP Project path is like that:
    JSP
    — admin
    — includes
    — users
    — WEB-INF
    —-WEB-INF\lib

    the Java Server project is a plain Java Project that contains the java sources

    If I have a file

    
    
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <%@ include file="../includes/getJspDirectory.inc"%>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>My JSP 'Test.jsp' starting page</title>
        
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        
        <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->
      </head>
      
      <body>
        This is my JSP page. <br>
      </body>
    </html>
    

    that references my include file getJspDirectory.inc

    When editing this file I see an error annotation when moving the mouse on this annotation I see this error
    ServerConfig cannot be resolved (in file ../includes/getJspDirectory.inc), ServerConfig is one of the classes in the JavaServer project.

    In getJspDirectory.inc there is an import for this file.
    the odd thing is when editing getJspDirectory.inc, if I type ServerConfig. I get IntelliSense for the static method and properties.
    Also if I add a page import on test.jsp the error annotation disappears.

    #238731 Reply

    Riyad Kalla
    Member

    Ahh thank you for explaining in more detail. When you try and get autocomplete in a scriplet for ServerConfig in your normal jsp page, does that work?

    BTW, I setup 2 new projects just as you described, and I get autocomplete and validation in my plain JSP file, from the use of MyClass in my inc file just fine, no errors.

    #238836 Reply

    Sam
    Participant

    Yeah it is fine in the inc file but not in the main jsp file, also in the main jsp file i get the error annotation as mentioned above.

    #238854 Reply

    Riyad Kalla
    Member

    Sam, because I was unable to reproduce this on my own, I will need you to either send me the projects in question or to createa new set of demo projects that exhibit this same problem and email them to [email protected] ATTN Riyad so I can reproduce this issue and file it.

    #239098 Reply

    Sam
    Participant

    Did you get my files?

    #239102 Reply

    Riyad Kalla
    Member

    Sam,
    I am really sorry for the delay, I had thought I didn’t get the files but went back and checked my email and I had received them right after I had asked for them.

    I changed the inc file to this:

    
    <%@ page import="com.eggtheory.brainfuse.ServerConfig.ServerConfig" %>
    
    <%
        ServerConfig server = new ServerConfig();
    %>
    

    And changed the JSP to this:

    
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ include file="includes\getJspRoot.inc"%>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>My JSP 'MyJsp.jsp' starting page</title>
        
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        
        <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->
      </head>
      
      <body>
        This is my JSP page. <br>
      </body>
    </html>
    

    And autocomplete worked fine as expected in the JSP page.

    #239460 Reply

    Sam
    Participant

    The solution below seems like you only had to add a line break between the first directive and the second import directive on the getJspDirectory.inc.
    This will not work for us because we are trying to decrease the whitespace incase there is a binary output of some jsp pages.

    Additionally even when I did that i still have the annotation next tot he include line saying that this class is not found, not within the included file but within the file in which the include is present.

    #239472 Reply

    Riyad Kalla
    Member

    Sam,
    My change was more than that (I don’t have a mental diff right now), just copy and paste the pages into your project, do they work? Don’t forget to clean/rebuild it.

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: project dependant imports error in jsp inc and jspf files

You must be logged in to post in the forum log in