Skip to Content
0
May 03, 2007 at 12:04 PM

DynPage Button Event Handler

23 Views

Hi all

Following is the code for Simple DynPage. But when I click on button I am getting Portal Runtime Error.

Pls check it out ..

<i>public class MyPage extends PageProcessorComponent {

public DynPage getPage() {

return new MyPageDynPage();

}

public static class MyPageDynPage extends DynPage {

public TextView text;

/**

  • Initialization code executed once per user.

*/

public void doInitialization() {

}

/**

  • Input handling code. In general called the first time with the second page request from the user.

*/

public void doProcessAfterInput() throws PageException {

}

/**

  • Create output. Called once per request.

*/

public void doProcessBeforeOutput() throws PageException {

Form myForm = this.getForm(); // get the form from DynPage

// create your GUI here....

text = new TextView();

text.setText("Hello Globe !");

myForm.addComponent(text);

Button click = new Button("Click Me");

click.setText("Click Me");

click.setEnabled(true);

click.setOnClick("Clicked");

myForm.addComponent(click);

}

public void Clicked(Event e) throws PageException{

text.setText("Button Clicked");

}

}

}</i>