Skip to Content
0
Feb 27, 2006 at 08:00 AM

Bean usage in JSPDynPage

11 Views

I am trying a very simple example.But i am unable to get what i want... i am getting blank field(null)

Source code goes as follows:

Dynpage:

package com.abc.basicexample;

import com.abc.basicexample.myBean;

import com.sapportals.htmlb.*;

import com.sapportals.htmlb.enum.*;

import com.sapportals.htmlb.event.*;

import com.sapportals.htmlb.page.*;

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

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

public class b extends PageProcessorComponent {

public DynPage getPage(){

return new bDynPage();

}

public static class bDynPage extends JSPDynPage{

public void doInitialization(){

}

public void doProcessAfterInput() throws PageException {

}

public void doProcessBeforeOutput() throws PageException {

((IPortalComponentRequest)getRequest()).getServletRequest().setAttribute("myBean", myBean);

myBean myBean = new myBean();

myBean.setName("bb");

this.setJspName("jsp2.jsp");

}

}

}

JSP:

<jsp:useBean id="myBean" scope="request" class="com.abc.basicexample.myBean" />

<hbj:content id="myContext" >

<hbj:page title="PageTitle">

<hbj:form id="myFormId" >

before:<%

out.println(myBean.getName());

/*myBean.setName("this my first Bean");

out.println("<br>");

out.println("after:");

out.println(myBean.getName());

*/

%>

</hbj:form>

</hbj:page>

</hbj:content>

Bean:

package com.abc.basicexample;

import java.io.Serializable;

public class myBean implements Serializable {

public String name;

public void setName(String name)

{

this.name=name;

}

public String getName()

{

return name;

}

}

Any pointers to where am i going wrong..

Thanks & Regards,