facebook

footer.jsp

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

    dfini
    Member

    this is the code I used inside all my jsp pages.

    <%@ include file=”footer.jsp” %>

    The problem is :
    This code is used in almost every jsp pages.
    <jsp:useBean id=”loginuser” class=”roomres.EmployeeBean” scope=”session”/>

    Inside the footer I need to get the following information
    if (loginuser.getRole()==1) { %>
    <a href=”menu_admin_e.jsp”>Administration Menu</a>
    <%}%>

    Since I declare the bean everywhere I am not supposed to declare the bean in the footer otherwise I received “duplicate declaration error” but
    if I don’t declare the bean I received loginuser not declared. So what I’m supposed to do????

    If I insert this code:
    <jsp:getProperty name=”loginuser” property=”role”/>
    I got the information but how can I used it?
    Why this one works and get the right info??

    Could you help me fix this problem please.

    #208378 Reply

    No Operation
    Member

    Some solutions
    1. IFRAME
    Use IFRAMEs, and the footer is no longer an included page, it is a separate page:

    <jsp:useBean id="loginuser" class="roomres.EmployeeBean" scope="session"/> 
     if (loginuser.getRole()==1) { %>
    <a href="menu_admin_e.jsp">Administration Menu</a>
    <%}%>
    

    2. separate bean
    Use a different bean instance in the footer.jsp. Dont forget to initialize that instance too.

    <jsp:useBean id="loginuser2" class="roomres.EmployeeBean" scope="session"/> 
     if (loginuser2.getRole()==1) { %>
    <a href="menu_admin_e.jsp">Administration Menu</a>
    <%}%>
    

    3. …

    NOP

    #208532 Reply

    Anonymous
    Member

    Thank you. I tried the both of them but in my case both of them cannot be used.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: footer.jsp

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