BBjspWebRequest::getAttributeNames (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

In BBj 16.0 and higher, this method returns a BBjVector containing the names of the attributes available to this request. This method returns an empty BBjVector if the request has no attributes available to it.

Syntax

Return Value

Method

BBjVector

getAttributeNames()

Parameters

None.

Return Value

a BBjVecor containg the names of the request's attributes.

Remarks

None.

Example

This example demonstrates how this works in a BBJSP web-page

<%
    REM == INITIALIZE SOME DATA
    #Request!.setAttribute("foo","This is FOO")
    #Request!.setAttribute("woo","This is WOO")
%>
<%@ taglib uri='/WEB-CFG/tld/core.tld' prefix='c' %>
<html>
    <body>
        <ul>
            <c:iterate data="<%= #getRequest().getAttributeNames() %>" id="name">
                <%
                    REM = Get the "name" from the page context
                    name$ = #PageContext!.getAttribute("name")
                %>
                <li><b>${name}</b> = <%= str(#getRequest().getAttribute(name$)) %>
            </c:iterate>
        </ul>
    </body>
</html>

This example demonstrates how this works in a BBJSP servlet

class public MyServlet

  field private BBjspWebRequest request!
  field private BBjspWebResponse response!
  field private BBjspWebSession session!
  
  method public void service(BBjspServletContext context!)
       
    #request! = context!.getRequest()
    #response! = context!.getResponse()

    #response!.setContentType("text/html")
    s! = #response!.getOutputStream()
    
    #session! = #request!.getSession()
    
    s!.write("<html><body><h1>Hello from BBJSP</h1>")
    vectNames! = #request!.getAttributeNames()
    sz = vectNames!.size()
    if sz then
      s!.write("<ul>")
      for i = 0 to sz - 1
        name$ = vectNames!.get(i)
        s!.write("<li>" + name$ + #request!.getAttribute(name$))
      next i
      s!.write("</ul>")
    endif
    s!.write("</body></html>")
  methodend
classend

See Also