Skip to Content
Former Member
Jul 26, 2005 at 05:51 PM

Accessing javascript from the dynpage



I am creating the JSP from within the dynpage. So in the doProcessBeforeOut() I am creating the tableviews and assiging components into it.

I need to create a javascript that would display a confirmation message before the user deletes a record. On the SAP website, there is a sample code that helps do that. Although I followed the example, the code doesn't seem to be able to access and read the javascript file.


In the dynpage:


IPortalComponentRequest request = (IPortalComponentRequest) getRequest();

String jsResource = request.getWebResourcePath() + "/";

this.getPageContext().getDocument().addHeadResource(ResourceType.JAVASCRIPT, "test", jsResource);

In the confirmation.js file: just for now, and to simplify it further I am just displaying an allert


function warn(){

alert("will be deleted")


In the dynpage again: where I am defining the button component


Button btnDelete = new Button("btnDelete");



//then I am adding the button to the form

btnDelete.setClientEvent(EventTrigger.ON_CLICK, "warn()");

Did anybody face the same problem? If yes, what would you suggest to do?