Skip to Content
0
Jul 30, 2008 at 02:50 AM

JSP Dynpage development

12 Views

Hi,

I am using JSPDynpages and am trying to save a value in my bean and get access to this value on my JSP page. I have not been able to get the value from my bean to the jsp page any thoughts on what I may be doing wrong would be appreciated.

Below is the code I am working with

Mike

public void doProcessBeforeOutput() throws PageException

{

myBean myBean = new myBean();

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

// fill your bean with data here...

myBean.setBappiReturn( "Hello World");

this.setJspName("JSPTest.jsp");

}

-


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

<%@ page import="com.sapportals.portal.prt.runtime.PortalRuntime" %>

<%@ page import="com.sapportals.portal.prt.resource.IResource" %>

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

<hbj:content id="myContext" >

<hbj:page title="PageTitle">

<hbj:form id="myFormId" >

<%= myBean.getBappiReturn()%>

</hbj:form>

</hbj:page>

</hbj:content>

-


import java.io.Serializable;

public class myBean implements Serializable

{

public String bappiReturn = "";

/**

  • @return

*/

public String getBappiReturn() {

return bappiReturn;

}

/**

  • @param string

*/

public void setBappiReturn(String string) {

bappiReturn = string;

}

}

-


<?xml version="1.0" encoding="UTF-8"?>

<application>

<application-config>

<property name="PrivateSharingReference" value="com.sap.portal.htmlb,com.sap.portal.themes.lafservice,com.sap.portal.navigation.service,com.sap.portal.navigation.helperservice,com.sap.portal.pagebuilder,jco,jcoclient"/>

</application-config>

<components>

<component name="JSPProject">

<component-config>

<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld" />

<property name="ClassName" value="JSPProject.JSPProject"/>

<property name="ComponentType" value="jspnative"/>

<property name="JSP" value="pagelet/JSPTest.jsp"/>

</component-config>

<component-profile>

<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>

</component-profile>

</component>

</components>

<services/>

</application>