Skip to Content
0
Former Member
Jul 07, 2005 at 05:18 AM

HTMLB Button

25 Views

Hello,

Iam trying to understand the htmlb Button.

can anybody explain what is wrong with the following code:

<b>button.java</b>

package com.sap;

import com.sapportals.htmlb.Button;

import com.sapportals.htmlb.event.Event;

import com.sapportals.htmlb.page.*;

import com.sapportals.portal.htmlb.page.*;

import com.sapportals.portal.prt.component.*;

public class button extends PageProcessorComponent {

public DynPage getPage(){

return new buttonDynPage();

}

public static class buttonDynPage extends JSPDynPage{

IPortalComponentResponse response = (IPortalComponentResponse) this.getResponse();

private button_bean myBean = null;

public void doInitialization(){

IPortalComponentSession componentSession = ((IPortalComponentRequest)getRequest()).getComponentSession();

Object o = componentSession.getValue("myBean");

if(o==null || !(o instanceof button_bean)){

myBean = new button_bean();

componentSession.putValue("myBean",myBean);

} else {

myBean = (button_bean) o;

}

}

public void doProcessAfterInput() throws PageException {

IPortalComponentSession componentSession = ((IPortalComponentRequest)getRequest()).getComponentSession();

myBean = (button_bean) componentSession.getValue("myBean");

}

public void doProcessBeforeOutput() throws PageException {

this.setJspName("button_display.jsp");

}

public void ProcessConfirm(Event event) throws PageException{

Button b = (Button) this.getComponentByName("OrderConfirm");

myBean.setMessage("Clicked");

b.setText(myBean.getMessage());

}

}

}

<b>button_display.jsp</b>

<%@ taglib uri="tagLib" prefix="hbj" %>

<jsp:useBean id="myBean" scope="application" class="com.sap.button_bean" />

<hbj:content id="myContext" >

<hbj:page title="PageTitle">

<hbj:form id="myFormId" >

<hbj:button

id="OrderConfirm"

text="Confirm"

width="125px"

tooltip="Click here to confirm order"

onClick="ProcessConfirm"

disabled="false"

design="STANDARD"

/>

</hbj:form>

</hbj:page>

</hbj:content>

<b>button_bean.java</b>

package com.sap;

import java.io.Serializable;

public class button_bean implements Serializable {

private String message;

public String getMessage(){

return message;

}

public void setMessage(String string){

this.message = string;

}

}

<b>

Iam getting the button displayed perfectly but clicking on it won't do any good.

Appreciate your time</b>

Message was edited by: Robert Drater