cancel
Showing results for 
Search instead for 
Did you mean: 

A problem about dropdownListBox

Former Member
0 Kudos

Hi,everyone.

I write a dropdownListBox.

<hbj:dropdownListBox

id="Class1Select"

selection="No"

onSelect="Class1_Selection"

>

<hbj:listBoxItem key="No" value="No" />

<hbj:listBoxItem key="NB" value="NB" />

<hbj:listBoxItem key="Mp3 "value="MP3" />

<hbj:listBoxItem key="LCD" value="LCD" />

</hbj:dropdownListBox>

I want to get the value when event onSelect is triggered.

So i write some codes in doProcessAfterInput()

DropdownListBox mySelect=(DropdownListBox) getComponentByName("Class1Select");

But i always get nothing.

Is it something wrong?

Thx

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

Your Jsp is OK.

JspDynpage Code

=================

package com.cts.anand;

import com.sapportals.htmlb.DropdownListBox;

import com.sapportals.htmlb.RadioButtonGroup;

import com.sapportals.htmlb.event.Event;

import com.sapportals.htmlb.page.DynPage;

import com.sapportals.htmlb.page.PageException;

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

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

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

public class SDN11 extends PageProcessorComponent {

public DynPage getPage(){

return new SDN11DynPage();

}

public static class SDN11DynPage extends JSPDynPage{

public void doInitialization(){

}

public void Class1_Selection(Event e) {

}

public void doProcessAfterInput() throws PageException {

DropdownListBox mySelect=(DropdownListBox)this.getComponentByName("Class1Select");

String s =mySelect.getSelection();

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

resp.write(s);

}

public void doProcessBeforeOutput() throws PageException {

this.setJspName("SDN11.jsp");

}

}

}

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Louis,

Try to get the value in the event handler Class1_Selection method. Try this.

DropdownListBox mySelect=(DropdownListBox) getComponentByName("Class1Select");

String sel = mySelect.getTextForKey(mySelect.getSelection());

Regards,

Harini S

Former Member
0 Kudos

Hi, Harini. thx for your help.

But it`s something wrong when i used .getTextForKey.

I already used getSelection() to get the value.

Thx a lot