cancel
Showing results for 
Search instead for 
Did you mean: 

BSP Element Expressions

Former Member
0 Kudos

Hi,

I am practicing on BSP Element Expressions and i have gone through the weblog by Brain McKellar. I am trying the same example given in the weblog but i am getting an exception at the statement

<bsp:bee bee = "<%= bee%>" /> in the layout.

I have not instantiated but i have declared it as an page attribute as given in the weblog.

Why am i getting an error? any help is highly appriciated.

Regards,

Azaz.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Azaz,

in the same blog at the end, the author has mentioned the fixes that need to be done to the code. Just check it out.

cheers,

Kumar

Former Member
0 Kudos

Hi Kumar,

If i am Instantiating the bee in the event onInitialization as shown below i am getting the solution...

data : bee1 type ref to clg_bsp_bee.

create object bee1.

if bee is initial.

bee = bee1.

endif.

But i don't know upto what extent i am write.

And one more thing is if i doesn't instantiate the bee in the OnInitialization Event i am getting the Exception.

I want know what is write solution for that.Instantiate or not?

If instantiation is compulsory then what is the correct way?

Regards,

Azaz Ali.

Former Member
0 Kudos

You have to instantiate the bee before you use it. otherwise the bee is not bound or is null so u'll get exception. The right way is to check the bee before you use it i.e.

change the html layout code this way.

<% if bee is bound. %>

<bsp:bee bee = "<%= bee%>" />

<% endif. %>

This is the first step. This way even if you don't instantiate the bee, u'll not get any exception or crash.

Second point is using the bee if instantiated properly.

Instantiation of bee is compulsory if you want to use it.

Do the instantiation anywhere where u think its correct. you can do it in OnInitialization handler or in inputProcessing etc. In the blog it is done in the OnInputProcessing.

As I said earlier, the fixes to make that code work properly are mentioned at the bottom of the blog.

Regards,

Kumar

Former Member
0 Kudos

Hi Kumar,

Thanks, your answer is very helpful.

Is there a standard class for bee so that i can use it for all bsp elements. So that we can instantiate it in oninitialization event.

Regards,

Azaz Ali.

Former Member
0 Kudos

Azaz,

I don't think so. Generally you declare a variable of type IF_BSP_BEE and assign it appropriate bee class object as per your requirement.

Regards,

Sirish