facebook

jsp include reference error

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #264069 Reply

    I have a jsp file in which i declared some variables.
    In this jsp i included another jsp with include page include directive which references the variables decared in parent jsp.

    The problem is that when when included jsp references the variables declared in parent jsp it is showing a reference error saying can not find the simbol.

    for ex:
    test.jsp
    ——–

    String periodkey = request.getParameter( “periodkey” );
    <%@ include file=”include.jsp” %>
    —–
    —-

    include.jsp
    ————

    productkey =———-

    here my eclipse showing an error in include.jsp as
    cannot find symbol: symbol : variable periodkey include.jsp

    #264145

    Riyad Kalla
    Member

    I couldn’t reproduce this problem. Can you download this project and import it into your workspace and see if the index.jsp file has a correct reference to the “test” variable from the include.jspf file?

    #265114

    The example you given is in reverse.

    first.jsp
    ———
    <% String pageTitle=”sridhar”;
    %>
    <%@ include file=”header.jsp” %>

    header.jsp
    ————-
    <html>
    <head>
    <title>Promotional Funds Management <%= pageTitle%></title>

    In this pageTitle will give error as symbol can not be resoved.

    Please give me the solution. In netbeans it’s not giving any error.

    #265147

    Riyad Kalla
    Member

    sridhar,
    This won’t give you a compile warning but it *will* give you a reconciler warning (markers in right margin), the reason is that your fragment is included inside your main page and then assembled, so your fragment does not have any scope of the “pageTitle” variable, so the warning is correct, but it’s not a compiler error.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: jsp include reference error

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