- This topic has 5 replies, 2 voices, and was last updated 20 years, 6 months ago by Riyad Kalla.
-
AuthorPosts
-
dfiniMemberthis 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.
*** Date: 15/06/04 10:11 AM
*** System properties:
awt.toolkit=sun.awt.windows.WToolkit
file.encoding=Cp1252
file.encoding.pkg=sun.io
file.separator=\
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.class.path=C:\eclipse\startup.jar
java.class.version=48.0
java.endorsed.dirs=C:\j2sdk1.4.2_04\jre\lib\endorsed
java.ext.dirs=C:\j2sdk1.4.2_04\jre\lib\ext
java.home=C:\j2sdk1.4.2_04\jre
java.io.tmpdir=c:\winnt\temp\
java.library.path=C:\j2sdk1.4.2_04\jre\bin;.;C:\WINNT\system32;C:\WINNT;C:\oracle\ora91\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\WINNT\system32\nls;C:\WINNT\system32\nls\ENGLISH;c:\lotus\notes;k:\notes;Z:.;Y:.;X:.;W:.;V:.
java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition
java.runtime.version=1.4.2_04-b05
java.specification.name=Java Platform API Specification
java.specification.vendor=Sun Microsystems Inc.
java.specification.version=1.4
java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory
java.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi
java.version=1.4.2_04
java.vm.info=mixed mode
java.vm.name=Java HotSpot(TM) Client VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Sun Microsystems Inc.
java.vm.specification.version=1.0
java.vm.vendor=Sun Microsystems Inc.
java.vm.version=1.4.2_04-b05
line.separator=
Riyad KallaMemberI believe you asked this question in another thread (or someone asked an identical question). When you have a JSP page that by itself cannot be compiled without external dependencies, the JSP spec dictates that good practice is to name that page .jspf for “JSP Fragment” (or more recently, “JSP Segment”). In your case, because footer.jsp cannot compile on its own, you should rename it to footer.jspf.
dfiniMemberI did ask the same question. I received two solutions. I knew and try the second solution before posting my request. For the first solution, I tried it but the action request by the footer endup in the frame instead of the main page.
I will try your solution. Why the footer is working with an other platform and not Eclipse?
Thank
dfini
Riyad KallaMemberWhy the footer is working with an other platform and not Eclipse?
What other ‘platform’ is it working with? If you are referring to NetBeans, this is because it does not offer JSP compilation, if you are referring to IntelliJ then I don’t know why this is working, it shouldn’t. And if you are talking about an application server, that is different, when the page is completely compiled before being hosted, it is valid, but before that point, it cannot be compiled individually (which is what MyEclipse does).
dfiniMemberI was referring to NetBeans and JdCreator which the later was used to create the first draft.
I rename the footer.jsp to footer.jspf and works find.
Thank you very much.
Riyad KallaMemberI’m glad its working now.
-
AuthorPosts