AquaLogic User Interaction Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Creating a Custom Pagelet with the Java IDK Proxy API

This example creates a simple pagelet that displays information from the proxy, including setting values.


  1. Before writing any code, create a new IDK project as described in Setting Up a Custom Java IDK Project in Eclipse Stand-Alone (without WTP) or Setting Up a Custom Java IDK Project in Eclipse with WTP.
  2. In the new project, create a new JSP page for the pagelet (pagelet.jsp).
  3. Implement your code. The pagelet code shown below instantiates the IDK and uses the IProxyContext interface to retrieve IProxyRequest and IProxyUser objects to access information about the user and the settings associated with the pagelet.
    Note: There is no need to include html, head and body tags; the display is handled by the Consumer resource.
<%@ page language='java' import='com.bea.alui.proxy.*' %>
<%
String Att1 = 'no setting';
String Att2 = 'no setting';
String sessionVariable = 'no setting';

//get the idk
IProxyContext proxyContext = ProxyContextFactory.getInstance().createProxyContext(request, response);
IProxyRequest proxyRequest = proxyContext.getProxyRequest()

IProxyUser proxyUser = proxyRequest.getUser();
String userName = proxyUser.getUserName(); 
int userID = proxyUser.getUserID();

Att1 = proxyRequest.getSetting('Att1')
Att2 = proxyRequest.getSetting('Att2');
sessionVariable = proxyRequest.getSetting('sessionVar');

byte[] payload = proxyRequest.getPayload().getText();
String payloadStr = new String(payload)
%>

<p>User name: <%=userName%><br/> 
User ID: <%=userID%><br/> 
Attribute 1: <%=Att1%><br/> 
Attribute 2: <%=Att2%><br/> 
Session variable: <%=sessionVariable%><br/> 
Payload: <textarea name=xml cols=80 rows=6> <%=payloadStr%> </textarea>
</p>

  Back to Top      Previous Next