MichaelGee
MichaelGee

Reputation: 51

XPages Java Class Instantiation as DataSource

I have a simple Java Class that implements serializable. Everything is fine but when I try to instantiate the class and pass the session as an argument I get the "command not handled" exception. When I instantiate the class without the session as a parameter (given the default constructor definition) I don't get an error. Is it not possible to instantiate a datasource with session as a parameter? I need the session later on.

import java.io.Serializable;
import lotus.domino.Session;


public class HtmlC implements Serializable{

/**
 * 
 */
private static final long serialVersionUID = -6630201769769372729L;
private String html;
private Session session;

public HtmlC(){

}

public HtmlC(Session session){
    this.session = session;
}

public void setHtml() {
    String htmlTable = "<table><thead><th></th></thead></table>"
    this.html = htmlTable;
}

public String getHtml() {
    return html;
}

}

Here is the xpage datasource

  <xp:this.data>
    <xe:objectData var="objectData1"
        createObject="#{javascript:return new org.lanl.data.HtmlC(session);}"
        scope="view" ignoreRequestParams="true" readonly="false">
        </xe:objectData>
    </xp:this.data>

Upvotes: 0

Views: 171

Answers (1)

MichaelGee
MichaelGee

Reputation: 51

I think my problem lies with the fact that session might not be Serializable. I'll just have to use a different method for getting data. I think the extension library has a method to get the current database.

Upvotes: 3

Related Questions