facebook

servlet include

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #207232 Reply

    John Myers
    Member

    I’m have a static include (in a jsp) for a header file (also a jsp) that declares a bunch of variables. All of them are showing up as errors in the other file since eclipse or myeclipse isn’t understanding that they are declared in the included file.

    Is this a bug or am I doing something wrong?

    John

    #207236 Reply

    Riyad Kalla
    Member

    John,
    If you have defined a bunch of vars in one JSP file like this:

    
    <%
        String one = "One";
        String two = "Two";
        String three = "Three";
    %>
    

    and then use an include to include this page in another file like this:

    
    <%@ include file="/vars.jsp" %>
    

    and then in your real page you try and do something like this:

    
    <%= one %>
    

    it should work fine (atleast I just verified that it worked fine using 2.8beta1).

    IF however you are getting error markers IN your included JSP page, the problem is that in the JSP Spec (1.2 and 2.0) they define JSP Fragments (or Segments) as JSP pages who’s sole purpose is to be included in another JSP page (e.g. they are never standalone). When pages are of this nature, for example a header, it is suggested by the spec that the pages be renamed to “.jspf”. This keeps them from being compiled on their own, since they cannot correctly compile without being included in another page first.

    #207482 Reply

    Riyad Kalla
    Member

    John,
    Did this fix your problem?

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: servlet include

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