Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem getting jsp component from jspdynpage

Hi,

I am making a call in my java class in method

doProcessBeforeOuput with the following call

table = (TableView) this.getComponentByName("tableview_AddMaterial");

Object[] objs = this.getComponents();

Both return nulls for the object, how does someone access the jsp tables or text fields defined by id in htmlb in your java code I did check and all these are defined

private IPageContext pageContext;

private IPortalComponentRequest request;

private IPortalComponentResponse response;

private IPortalComponentSession session;

private IPortalComponentContext userContext;

private IPortalComponentProfile userProfile;

Also here is my htmltable in the jsp

<hbj:tableView

id="tableview_AddMaterial"

model="DHB.queryResultsModel"

design="TRANSPARENT"

headerVisible="false"

footerVisible="true"

visibleRowCount="50"

visibleFirstRow="1"

selectionMode="MULTISELECT">

</hbj:tableView>

Any help would be greatly appreciated and I do reward points for helpful answers

Cheers,

Devlin

Former Member replied

Hi Devlin

You can access the fields in jsp as follows.For example, consider tableview with id "myTableView".

<b>TableView table = (TableView) this.getComponentByName("myTableView");</b>

If you add this line, you can get all the values related to tableview.For example, to get the first visible row of the tableview, the code goes as follows.

<b>int firstVisibleRow = table.getVisibleFirstRow();</b>

Jsp for the same:

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

<hbj:tableView

id="myTableView"

model="tablebean.model"

design="ALTERNATING"

headerVisible="true"

footerVisible="true"

selectionMode="MULTISELECT"

headerText="Office locations"

visibleFirstRow="1"

visibleRowCount="5"

rowCount="16"

width="500px">

</hbj:tableView>

Try and let me know the results.

Hope this helps.

Regards

Yoga

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question