makumba Attributes#

Attributes in Java Server Pages#

Java Server Pages use attributes to keep the state of the application (request-, session- and context-scoped). These can be accessed and modified e.g.
  • via Java
<% Object name = request.getAttribute("name"); %>;
<% pageContext.setAttribute("someName", "John Dorian"); %>
<% pageContext.setAttribute("now", new java.util.Date()); %>
  • via JSTL
<c:out value="${name}"/>
<c:set var="someName" value="John Dorian" />
  • via JSP Tags
 <jsp:useBean id="now" class="java.util.Date"/> 
  • via JSP EL (reading only)

Attributes in makumba#

makumba builds upon this its own notion of Attributes that keep the state of a makumba application. They represent the "environment" of that Makumba application

The typical example is a JSP page during execution, with its HTTP CGI parameters and session, request and page attributes as attributes. Makumba can access these attributes in queries and forms, such as <mak:list> or <mak:input> tags; they are denoted by a leading "$".

If we consider an URL such as employeeProfile.jsp?employee=hhi4xw7 with a CGI parameter 'employee', Makumba can use this parameter in a query such as:

<mak:list from="company.Employee e" where="e=$employee">

Likewise, if there is a session-scope Attribute "activeUser", Makumba can use it in the same manner:

<h1>My Profile</h1>
<mak:list from="company.Employee e" where="e=$activeUser">

Note that when accessing these parameters and attributes with Java or JSTL, you will have to use different methods:

  • Parameters:
Java: <% Object employee = request.getParamter("employee"); %>
JSP EL: ${param.employee}
  • Attributes:
Java: <% Object activeUser = session.getAttribute("activeUser"); %>
JSP EL: ${activeUser}

Technical background#

Since other kinds of attributes are possible, the attribute specification is kept HTTP-independent. Makumba Business Logics code sees the attributes as an org.makumba.Attributes object.

Category Documentation

Add Comment
« This page was last updated on March 28 2011