admin@glassfish.java.net

[v3] how to link _at_handler to jsf

From: Claudio Miranda <claudio_at_claudius.com.br>
Date: Sun, 6 Apr 2008 18:55:54 -0300

    I am trying to show a admin console plugin (based on
j1plugin/gfplugin/myplugin), btw thanks for this.

    I was able to construct the desired window, at JSF level and
display at admin console.
    Now I want to make the JSF code to display a table.
    But when rendering at admin console I get an exception

PWC1406: Servlet.service() for servlet FacesServlet threw exception
com.sun.jsftemplating.layout.SyntaxException: Handler
'getServerCertificates' in event 'beforeCreate' is not declared!
Ensure the '_at_Handler' annotation has been defined on the handler Java
method, that it has been compiled with the annotation processing tool,
and that the resulting 'META-INF/jsftemplating/Handler.map' is located
in your classpath (you may need to do a clean build).

See the relevant source code

jsf page
<sun:page id="page1">
    <!beforeCreate
        setResourceBundle(key="i18n" bundle="core.Strings")
        setPageSessionAttribute(key="configName",
value="$requestParameter{configName}");
        getServerCertificates(result=>$attribute{listOfRows} );
    />

<sun:table id="deployTable" title="$resource{cert.server.table_title}"
sortPanelToggleButton="#{false}"
       deselectMultipleButton="$boolean{true}"
        deselectMultipleButtonOnClick="setTimeout('changeThreeTableButtons()',
0)"
        selectMultipleButton="$boolean{true}"
        selectMultipleButtonOnClick="setTimeout('changeThreeTableButtons()',
0)" >
         <!afterCreate
            getClientId(component="$this{component}" clientId=>$page{tableId});
        />

<sun:tableRowGroup id="rowGroup1" selected="#{td.value.selected}"
data={"$attribute{listOfRows}"} sourceVar="td">
    <!afterCreate
         getClientId(component="$this{component}"
clientId=>$page{tableRowGroupId});
    />


public class CertificateImpl {

    @Handler(id = "getServerCertificates",
    output = {
        @HandlerOutput(name = "result", type = java.util.List.class)
    })
    public static void getServerCertificates(HandlerContext handlerCtx) {
        List result = new ArrayList(4);
// some code
        handlerCtx.setOutputValue("result", result);
    }
}

    BTW, I am not able to correctly understand this construct. I see they are:

getDeployedWebInfo: method name, as void static (does it need to be
static void ?)
serverName: HandlerInput (inform parameters to the method)
result: the method return

but, what about $attribute(listOfRows) and this => attribution syntax ?

getDeployedWebInfo(serverName='#{request.serverName}',
result=>$attribute{listOfRows} );


Thanks

-- 
 Claudio Miranda
 _______________________________________________