cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot access bean property myBean.model

Former Member
0 Kudos

I am getting similar error can someone please help

Portal Runtime Error

An exception occurred while processing a request for :

iView : pcd:portal_content/wwy.wwykeystone/wwy.keystoneroles/wwy.r.waw.level1.general/WAW/KeystoneEmployee/keystoneCompetency/EssComphistorytest

Component Name : ESSCompetencyHistroy.CompHistory

Tag tableView attribute model: Cannot access bean property myBean.model in page context.

Exception id: 02:46_11/08/05_0022

See the details for the exception ID in the log file

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

my Bean

package com.wwy.ess;

import java.io.Serializable;

import java.util.Vector;

import com.sapportals.connector.execution.structures.IRecordSet;

import com.sapportals.htmlb.table.DefaultTableViewModel;

import com.sapportals.htmlb.table.TableViewModel;

public class TableBean implements Serializable {

public DefaultTableViewModel model;

public void setModel(DefaultTableViewModel model) {

this.model = model;

}

public TableViewModel getModel() {

return this.model;

}

public void createData(IRecordSet table) {

//this is your column names

Vector column = new Vector();

column.addElement("Competency");

column.addElement("Required for Current Position?");

column.addElement("Proficiency");

column.addElement("Valid From");

column.addElement("Valid To");

//all this logic is for the data part.

Vector rVector = new Vector();

try {

table.beforeFirst();

while (table.next()) {

Vector data = new Vector();

data.addElement(table.getString("QUALIFICATION"));

data.addElement(table.getString("REQUIRED"));

data.addElement(table.getString("PROFICIENCY"));

data.addElement(table.getString("VBEGD"));

data.addElement(table.getString("VENDD"));

rVector.addElement(data);

}

this.setModel(new DefaultTableViewModel(rVector, column));

} catch (Exception e) {e.printStackTrace();}

//this is where you create the model

this.setModel(new DefaultTableViewModel(rVector, column));

}

}

component

public class CompHistory extends PageProcessorComponent {

public DynPage getPage() {

return new CompHistoryDynPage();

}

public static class CompHistoryDynPage extends JSPDynPage {

private TableBean myBean = null;

public void doInitialization() {

IPortalComponentProfile profile =

((IPortalComponentRequest) getRequest())

.getComponentContext()

.getProfile();

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

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

myBean = new TableBean();

profile.putValue("myBean", myBean);

} else {

myBean = (TableBean) o;

}

// fill your bean with data here...

IPortalComponentRequest request =

(IPortalComponentRequest) this.getRequest();

doJca(request);

}

public void doProcessAfterInput() throws PageException {

}

public void doProcessBeforeOutput() throws PageException {

this.setJspName("ShowTable.jsp");

}

private IConnection getConnection(

IPortalComponentRequest request,

String alias)

throws Exception {

IConnectorGatewayService cgService =

(IConnectorGatewayService) PortalRuntime

.getRuntimeResources()

.getService(

IConnectorService.KEY);

ConnectionProperties prop =

new ConnectionProperties(

request.getLocale(),

request.getUser());

return cgService.getConnection(alias, prop);

}

public void doJca(IPortalComponentRequest request) {

IConnectionFactory connectionFactory = null;

IConnection client = null;

String rfm_name = "ZHRWPC_RFC_EP_READ_SKILLS_ASSO";

try {

try {

//pass the request & system alias

//Change the alias to whatever the alias is for your R/3 system

client = getConnection(request, "SAP_R3_HumanResources");

} catch (Exception e) {

System.out.println(

"Couldn't establish a connection with a target system.");

return;

}

/*

  • Start Interaction

  • */

IInteraction interaction = client.createInteractionEx();

IInteractionSpec interactionSpec =

interaction.getInteractionSpec();

interactionSpec.setPropertyValue("Name", rfm_name);

/*

  • CCI api only has one datatype: Record

  • */

RecordFactory recordFactory = interaction.getRecordFactory();

MappedRecord importParams =

recordFactory.createMappedRecord(

"CONTAINER_OF_IMPORT_PARAMS");

IFunctionsMetaData functionsMetaData =

client.getFunctionsMetaData();

IFunction function = functionsMetaData.getFunction(rfm_name);

if (function == null) {

System.out.println(

"Couldn't find " + rfm_name + " in a target system.");

return;

}

/*

  • How to invoke Function modules

  • */

System.out.println("Invoking... " + function.getName());

MappedRecord exportParams =

(MappedRecord) interaction.execute(

interactionSpec,

importParams);

/*

  • How to get structure values

  • */

IRecord exportStructure = (IRecord) exportParams.get("RETURN");

String columnOne = exportStructure.getString("TYPE");

String columnTwo = exportStructure.getString("CODE");

String columnThree = exportStructure.getString("MESSAGE");

System.out.println(" RETURN-TYPE = " + columnOne);

System.out.println(" RETURN-CODE = " + columnTwo);

System.out.println(" RETURN-MESSAGE =" + columnThree);

/*

  • How to get table values

  • */

IRecordSet exportTable =

(IRecordSet) exportParams.get("SKILLS");

exportTable.beforeFirst();

// Moves the cursor before the first row.

while (exportTable.next()) {

String column_1 = exportTable.getString("QUALIFICATION");

String column_2 = exportTable.getString("REQUIRED");

String column_3 = exportTable.getString("PROFICIENCY");

String column_4 = exportTable.getString("VBEGD");

String column_5 = exportTable.getString("VENDD");

}

//create the tableview mode in the bean

myBean.createData(exportTable);

/*

  • Closing the connection

  • */

client.close();

} catch (ConnectorException e) {

//app.putValue("error", e);

System.out.println("Caught an exception: \n" + e);

} catch (Exception e) {

System.out.println("Caught an exception: \n" + e);

}

}

}

}

portalapp

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

<application>

<application-config>

<property name="PrivateSharingReference" value="com.sap.portal.htmlb,com.sap.portal.ivs.connectorservice"/>

</application-config>

<components>

<component name="CompHistory">

<component-config>

<property name="ClassName" value="com.wwy.ess.CompHistory"/>

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

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

</component-config>

<component-profile>

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

<property name="SecurityZone" value="low_safety"/>

</component-profile>

<component-profile/>

</component>

</components>

<services/>

</application>

Former Member
0 Kudos

Hi Tegala,

Get rid of the following two lines from your portalapp.xml.

<property name="ComponentType" value="jspnative"/>
<property name="JSP" value="pagelet/ShowTable.jsp/"/>

Add a line

<property name="SecurityZone" value="com.wwy.ess/low_safety"/>

Answers (4)

Answers (4)

Former Member
0 Kudos

Prakash,

Changed as you specified, still getting this error. I did specify the bean scope as Application still gives me this error .

Thanks very much for your help

pcd:portal_content/wwy.wwykeystone/wwy.keystoneroles/wwy.r.waw.level1.general/WAW/KeystoneEmployee/keystoneCompetency/EssComphistorytest

Component Name : ESSCompetencyHistroy.CompHistory

Tag 'tableView', attribute 'model': Attribute 'TableBean' not found in the context (page context, request, session, application).

Exception id: 10:28_12/08/05_0122

See the details for the exception ID in the log file

raj_balakrishnan3
Participant
0 Kudos

Add a constructor in your bean and instantiate the model like this.

public TableBean(){

model = new DefaultTableViewModel();

}

Former Member
0 Kudos

Shiva i am setting model in bean,

Prakash here is my JSP

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

<jsp:useBean id="myBean" scope="application" class="com.wwy.ess.TableBean" />

<hbj:content id="myContext" >

<hbj:page title="PageTitle">

<hbj:form id="myFormId" >

<hbj:tableView

id="myTableView1"

model="myBean.model"

design="ALTERNATING"

headerVisible="true"

footerVisible="true"

fillUpEmptyRows="true"

navigationMode="BYLINE"

selectionMode="MULTISELECT"

headerText="Associate Competency History"

onNavigate="myOnNavigate"

visibleFirstRow="1"

visibleRowCount="5"

width="500 px"

/>

</hbj:form>

</hbj:page>

</hbj:content>

Former Member
0 Kudos

There is nothing wrong with your JSP. Have you deined as model public like following in the bean. Post your bean and how you are creating your bean in JSPDynpage.

public DefaultTableViewModel model;

Former Member
0 Kudos

can you post your JSP.

Former Member
0 Kudos

Hi,

I think your bean class doesn't have get/set methods for model.

Hope this might help you.

Thanks,

Shiva