[Dspace-general] Communities list in navigation bar

hardik mishra hardik_hunt at yahoo.com
Tue Sep 29 03:22:01 EDT 2009


Hi Hector

In home.jsp , you can save communities attribute in session and can use in any page.

session.setAttribute("communities",communities);

Then in navbar-default.jsp

Use  : Community[] communities = (Community[]) session.getAttribute("communities"); 
any where in declare section <% ......%>

Best Regards
Hardik Mishra
Software Engineer 
Webinito Networks

http://bit.ly/uJ60P - Join Us on Facebook
http://www.twitter.com/webinito - Follow us on Twitter


Give a man a fish, and you feed him for a day. Teach a man to catch fish and you feed him for a lifetime. 




________________________________
From: Héctor Garcia Peris <hector.garcia at ivie.es>
To: dspace-general at mit.edu
Sent: Tuesday, September 29, 2009 12:24:33 PM
Subject: [Dspace-general] Communities list in navigation bar

Hello,

I want to have a list of communities in my navigator bar in the same way 
that I have in the home page. I tried to reuse the code in home.jsp page 
in the navbar-default.jsp file. But the problem is that when I try to 
get the communities attribute with this commands:

140: <%@ page import="org.dspace.content.Community" %>
141: <%
142:    Community[] communities = (Community[]) 
request.getAttribute("communities");
143:    if (communities.length != 0)
144:    {
145:%>

I get a java.lang.NullPointerException in line 143. That is because the 
communities attribute is not instanced in this file, but it's instanced 
in the home.jsp page. Is there any way to get the communities in the 
navbar-default.jsp file?

Thanks.

-- 

---------------------------------------------------------------------
Héctor Garcia Peris
Dpto. Informática
Instituto Valenciano de Investigaciones Económicas S.A. (Ivie) 
C/ Guardia Civil, 22 esc-2 1º 46020 - Valencia (Spain) 
Tfno.: +34 - 963190050 / +34 - 963930816 
Fax.: +34 - 963190055 / +34 - 963930856 
e-mail: hector.garcia at ivie.es 
Web: http://www.ivie.es
----------------------------------------------------------------------

_______________________________________________
Dspace-general mailing list
Dspace-general at mit.edu
http://mailman.mit.edu/mailman/listinfo/dspace-general



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/dspace-general/attachments/20090929/2487c7a5/attachment.htm


More information about the Dspace-general mailing list