MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
dfini
Post subject: footer.jsp  PostPosted: Jun 10, 2004 - 06:43 PM



Joined: Apr 29, 2004
Posts: 12

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.
 
 View user's profile Send private message  
Reply with quote Back to top
nop
Post subject:   PostPosted: Jun 11, 2004 - 06:59 PM
Registered Member
Registered Member


Joined: May 05, 2003
Posts: 189
Location: in your JVM
Some solutions
1. IFRAME
Use IFRAMEs, and the footer is no longer an included page, it is a separate page:
Code:
<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.
Code:
<jsp:useBean id="loginuser2" class="roomres.EmployeeBean" scope="session"/>
 if (loginuser2.getRole()==1) { %>
<a href="menu_admin_e.jsp">Administration Menu</a>
<%}%>


3. ...

NOP
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Guest
Post subject:   PostPosted: Jun 15, 2004 - 03:00 PM






Thank you. I tried the both of them but in my case both of them cannot be used.
 
   
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits