Set session timeout in Weblogic

There are two ways user's HTTP session timeout can be set for your web application.
1.       Web.xml
2.       Weblogic.xml

Web.xml
<session-config>
  <session-timeout>60</session-timeout>
</session-config>
Please note in web.xml the session timeout is set in minutes.

Weblogic.xml
<session-descriptor>
    <session-param>
        <param-name>TimeoutSecs</param-name>
        <param-value>3600</param-value>
    </session-param>
</session-descriptor>
In weblogic.xml the session timeout is set in seconds.

More importantly the timeout value set in web.xml takes precedence over weblogic.xml. If you don't set any values in web.xml, weblogic.xml takes over. I think it is better to handle session timeout in web.xml itself since web.xml takes precedence over application server’s deployment descriptors.

Drawbacks of Ajax

We all know how Ajax is important in today's world. Thanks to google. You can develop rich and interactive web/portal applications by using combination of Ajax, Java script, REST APIs. I am not against Ajax but I honestly think one should know when to use it and when NOT to use it. Here are some known limitations of using Ajax.
 
1. Not all browsers supports Ajax. Though IE 5.x, 6.x, Mozilla 1.x, Firefox still supports.
2. XMLHttpRequest is not supported in older version. No standardization of XMLHttpRequest yet.
3. Java Script code could be visible to a hacker.
4. UI developers must have JavaScript skills.
5. Ajax based applications are difficult to debug, test and maintain.
6. Toolkit/Frameworks are still maturing.
7. Lack of design patterns or best practices guidelines yet.
8. Server side developers need to understand, presentation logic is required both at client & server side as well.
9. Namespace collision is possible.

How to implement breadcrumb in Weblogic Portal

Breadcrumbs is one of the cool features of weblogic portal framework for UI navigation. We have successfully implemented this functionality for one our portal applications. The JSP is given below which is based on weblogic portal 10.2 version. I think it should work with weblogic portal 10.3 as well. Let me know if you are running into any issues with this JSP. This jsp should be included as part of page.jsp.

Breadcrumb.jsp:
<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ page import="com.bea.netuix.servlets.controls.window.WindowPresentationContext,
                 com.bea.netuix.servlets.controls.window.TitlebarPresentationContext,
                 java.util.ArrayList,
                 java.util.Iterator,
                 com.bea.portlet.PageURL,
                 com.bea.netuix.servlets.controls.page.BookPresentationContext,
                 com.bea.netuix.servlets.controls.page.PagePresentationContext,
                 com.bea.netuix.servlets.controls.window.WindowCapabilities"
%>
<%@ page session="false"%>
<%@ taglib uri="http://www.bea.com/servers/portal/tags/netuix/render" prefix="render" %>

<%--
    This is the JSP for the showing breadcrumbs in XYZ Eagle portal.
    It is part of the skeleton file page.jsp.

    Implementation based on WebLogic Portal 10.2.

    Author ::      Ananth Kannan
--%>

<%
    ArrayList breadcrumbTitles = new ArrayList();
    ArrayList breadcrumbURLs = new ArrayList();
    boolean isHidden = false;

    BookPresentationContext book = BookPresentationContext.getBookPresentationContext(request);
    PagePresentationContext pageCtx = PagePresentationContext.getPagePresentationContext(request);

    if (!(book.getDefaultPage().equals(pageCtx.getDefinitionLabel())))
    {
        breadcrumbTitles.add(book.getTitle());
        breadcrumbURLs.add(PageURL.createPageURL(request,response,book.getDefaultPage()).toString());
    }
   
        PagePresentationContext parentPage = book.getParentPagePresentationContext();
        while (parentPage != null)
        {
            breadcrumbTitles.add(parentPage.getTitle());

            if (parentPage instanceof BookPresentationContext)
            {
                BookPresentationContext parentBook = (BookPresentationContext)parentPage;
                breadcrumbURLs.add(PageURL.createPageURL(request, response,  parentBook.getDefaultPage()).toString());
            }
            else
            {
                breadcrumbURLs.add(PageURL.createPageURL(request, response, parentPage.getDefinitionLabel()).toString());
            }
   
            parentPage = parentPage.getParentPagePresentationContext();
        }
%>
         

<%            
            //DO NOT SHOW BREADCRUMBS IN MAIN HOME PAGE and also in hidden page
            if (pageCtx.isHidden())
            {
            }
            else
            {               
%>
     <ul class="breadcrumbs">
<%
        for (int i = breadcrumbTitles.size() - 1; i >= 0; i--)
        {
            if (((String)breadcrumbTitles.get(i)).equalsIgnoreCase("My Main Book")) {
                    breadcrumbTitles.set(i, "My Home");
            }
           
%>
            <li class="first"><a href="<%=breadcrumbURLs.get(i) %>" ><%=breadcrumbTitles.get(i)%></a></li> <img src="<render:getSkinPath imageName="/arrow_right.gif" />" />&nbsp;  <%
        }
%>
<%
    }
%>
        </ul>